package com.car.web.controller.index;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.car.dal.object.*;

import net.sf.json.JSONObject;

import org.apache.log4j.Logger;


import org.json.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.car.dal.dao.daikuan.DaikuanDao;
import com.car.dal.dao.demand.TgDemandDao;
import com.car.dal.dao.department.TgDepartmentDao;
import com.car.dal.dao.duty.TgDutyDao;
import com.car.dal.dao.inspProblem.InspProblemDao;
import com.car.dal.dao.inspection.InspectionDao;
import com.car.dal.dao.invoice.TgInvoiceDao;
import com.car.dal.dao.leave.LeaveDao;
import com.car.dal.dao.moneys.TgMoneyDao;
import com.car.dal.dao.notice.TgNoticeDao;
import com.car.dal.dao.office.TgOfficeDao;
import com.car.dal.dao.partjob.TgParjobDao;
import com.car.dal.dao.performance.PerformanceAcountDao;
import com.car.dal.dao.period.TgPeriodDao;
import com.car.dal.dao.personnel.PersonnelStateDao;
import com.car.dal.dao.recruitment.RecruitmentDao;
import com.car.dal.dao.reserve.TgReserveDao;
import com.car.dal.dao.task.TgTaskDao;
import com.car.dal.dao.tiyanke.TgTiyankeDao;
import com.car.dal.dao.travel.TgTravelDao;
import com.car.dal.dao.user.QqgroupDao;
import com.car.dal.dao.user.UserDao;
import com.car.dal.dao.user.UserinfoDao;
import com.car.dal.dao.usergroup.TgUsergroupDao;
import com.car.dal.dao.work.TgworkDao;
import com.car.exception.BaseException;
import com.car.service.TgTurnover.TgTurnoverService;
import com.car.service.blackphone.Blackphoneservice;
import com.car.service.task.TaskService;
import com.car.service.tgPeriod.TgPeriodService;
import com.car.util.DateUtil;
import com.car.util.JsonExecutor;
import com.car.util.JsonExecutor.JsonBiz;
import com.car.util.HttpUtil;
import com.car.util.JsonValidator;
import com.car.util.Page;
import com.car.util.PageUtil;
import com.car.util.Result;
import com.car.util.ResultSupport;
import com.car.util.StringUtil;
import com.car.util.UserUtil;
import com.car.util.WebExecutor;
import com.car.util.WriterExcel;
import com.car.util.WebExecutor.Biz;
import com.car.web.controller.base.BaseController;
import com.car.web.controller.base.BaseVo;
import com.google.gson.Gson;

/**
 * 登录控制
 * 
 * @author Administrator
 * 
 */
@Controller
@RequestMapping("/index")
public class WorkController extends BaseController {

	private static final Logger logger = Logger.getLogger(WorkController.class);
    @Resource
    private UserDao userDao;
    @Resource
	private TgworkDao workDao;
    @Resource
    private TgUsergroupDao tgUsergroupDao;
    @Resource
    private TgDepartmentDao tgDepartmentDao;
    @Resource
    private UserinfoDao userinfoDao;
    @Resource
    private TgOfficeDao tgOfficeDao;
    @Resource
    private QqgroupDao groupDao;
    @Resource
    private TgDutyDao dutyDao;
    @Resource
    private TgNoticeDao noticeDao;
    @Resource
    private TaskService taskSerice;
    @Resource
    private TgTaskDao taskDao;
    @Resource
    private TgTravelDao travelDao;
    @Resource
    private TgPeriodDao periodDao;
    @Resource
    private TgParjobDao parjobDao;
    @Resource
    private TgDemandDao demandDao;
    @Resource
    private TgPeriodService tgPeriodService;
    @Resource
	private TgTurnoverService tgTurnoverService;
    @Resource
    private Blackphoneservice blackphoneservice;
    @Resource
	private RecruitmentDao recruitmentDao;
    @Resource
    private LeaveDao leaveDao;
    @Resource
    private DaikuanDao daikuanDao;
    @Resource
    private InspectionDao inspectionDao;
    @Resource
    private InspProblemDao inspProblemDao;
    @Resource
    private PersonnelStateDao  personnelStateDao;
    @Resource
    private TgInvoiceDao  InvoiceDao;
    @Resource
	private PerformanceAcountDao performanceAcountDao;
    @Resource
   	private TgMoneyDao moneyDao;
   	@Resource
    private TgTiyankeDao  tgTiyankeDao;
   	@Resource
	private TgReserveDao reserveDao;
    //初始欢迎页面
    @RequestMapping(value = "/admin_hello")
   	public ModelAndView struct_info(ModelMap modelMap, final LoginVo loginVo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, loginVo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgNotice notice =  new TgNotice();
				notice = noticeDao.getNoticeLast(notice);
				
				result.setDefaultModel("notice", notice);
   				return result;
   			}
   		});
   		return new ModelAndView("admin_hello", modelMap);
   	}
    
    
 	//工作日志，进入工作日志页面，同时查出今日的工作信息
    @RequestMapping(value = "/work_today")
	public ModelAndView login(ModelMap modelMap, final LoginVo loginVo,
			final HttpServletRequest request, final HttpServletResponse response)
			throws Exception {
		modelMap = WebExecutor.execute(logger, loginVo, new Biz() {
			public Result process() {
				Result result = new ResultSupport(true);
				try { 
					String time = "";
					String date = request.getParameter("date");
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					DecimalFormat df = new DecimalFormat("######0.0");
					SimpleDateFormat sd = new SimpleDateFormat("HH:mm");
					
					TgUser user = UserUtil.getUserFromCookies();
					
					if(date!=null && !"".equals(date)){
						time=date;
						result.setDefaultModel("date", time);
					}else{
						time = sdf.format(DateUtil.getToDay());
					}
					String week = DateUtil.convWeek(DateUtil.getDateWeek(sdf.parse(time)));
					result.setDefaultModel("time", time);
					result.setDefaultModel("week", week);
					List<TgWork> list = workDao.getTgWorkBytime(user.getUsername() ,time);
					if(list!=null && list.size()>0){
						TgWork  work = list.get(0);
						//日志内容
						if(work.getContent()!=null && !"".equals(work.getContent())){
							JsonValidator json = new JsonValidator();
							Boolean flag = json.validate(work.getContent());
							String ObjContent = "";
							if(flag){
								ObjContent = work.getContent();
							}else{
								byte[] bytes=StringUtil.hexDecode(work.getContent());
								ObjContent = new String(bytes, "UTF-8");
							}
							JSONArray array = new JSONArray(ObjContent);
							List<Content> contentList = new ArrayList<Content>();
							Gson gson = new Gson();
							for(int i=0;i<array.length();i++){
								Content content = gson.fromJson(array.get(i).toString(), Content.class);
								contentList.add(content);
							}
							if(contentList!=null && contentList.size()>0){
								for(Content content:contentList){
									if(content.getTime()!=null){
										String[] time2 = content.getTime().split("-");
										if(time2!=null){
											Date start = sd.parse(time2[0]);
											Date end = sd.parse(time2[1]);
											Long stime = end.getTime()-start.getTime();
											String count = df.format((double)stime/1000/60/60);
											content.setCount(count);
										}
									}
								}
							}
							result.setDefaultModel("contentList", contentList);
						}
						
						//日志图片
						if(work.getImages()!=null && !"".equals(work.getImages()) && !"图片".equals(work.getImages())){
							String img = work.getImages().replace("图片,", "");
							String[] imgs = img.split(",");
							result.setDefaultModel("imgs", imgs);
						}
						
						result.setDefaultModel("work", work);
					}else{
						return result;
					}
					
				} catch (Exception e) {
					e.printStackTrace();
				}
				return result;
			}
		});
		return new ModelAndView("work/work_today", modelMap);
	}
    
    @RequestMapping(value = "/work_manager")
	public ModelAndView work_manager(ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, final HttpServletResponse response)
			throws Exception {
		modelMap = WebExecutor.execute(logger, vo, new Biz() {
			public Result process() {
				Result result = new ResultSupport(true);
				try { 
						String nickname = request.getParameter("nickname");
						String xun_user = request.getParameter("xun_user");
						String startTime = request.getParameter("startTime");
						String endTime = request.getParameter("endTime");
						SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
						
						TgWork work = new TgWork();
						if(nickname!=null && !"".equals(nickname)){
							work.setNickName(nickname);
							result.setDefaultModel("nickname", nickname);
						}
						if(xun_user!=null && !"".equals(xun_user)){
							work.setXun_user(xun_user);
							result.setDefaultModel("xun_user", xun_user);
						}
						if(startTime!=null && !"".equals(startTime)){
							Date date = sdf.parse(startTime);
							work.setStartTime(date.getTime()/1000+"");
							result.setDefaultModel("startTime", startTime);
						}
						if(endTime!=null && !"".equals(endTime)){
							Date date = sdf.parse(endTime);
							work.setEndTime(date.getTime()/1000+"");
							result.setDefaultModel("endTime", endTime);
						}
						Integer currPage = 1 ;
						if (vo.getCurrPage()!=null&&!"".equals(vo.getCurrPage())) {
							currPage=vo.getCurrPage();
						}
						Integer total = workDao.getWorkByTypeCount(work);
						Page page = PageUtil.createPage(8, currPage, total);
						List<TgWork> list = workDao.getWorkByType(work,page);
						if(list!=null && list.size()>0){
							for(TgWork tgWork:list){
								//时间转换
								tgWork.setCreateTime(sdf.format(new Date(tgWork.getCreatedate()*1000)));
							}
						}
						result.setDefaultModel("page", page);
						result.setDefaultModel("list", list);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return result;
			}
		});
		return new ModelAndView("work/work_manager", modelMap);
		
	}
    
    //添加工作日志
    @RequestMapping(value = "/addWork")
    public ModelAndView addWork (ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, HttpServletResponse response)
					throws BaseException {
		modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
			public Result process() {
				Result result = new ResultSupport(true);
				
				String time = null;
				String date = request.getParameter("date");
				String content = request.getParameter("content");
				String images = request.getParameter("images");
				TgWork work = new TgWork();
				TgUser user = UserUtil.getUserFromCookies();
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
				
				Date t = null;
				if(date!=null && !"".equals(date)){
					try {
						t = sdf.parse(date);
						time = sdf.format(t);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}else{
					try {
						t = DateUtil.getToDay();
						time = sdf.format(DateUtil.getToDay());
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
				List<TgWork> list = workDao.getTgWorkBytime(user.getUsername() ,time);
				
				if(list!=null && list.size()>0){
					work.setId(list.get(0).getId());
					work.setUsername(user.getUsername());
					work.setContent(content);
					work.setImages("图片"+images);
					work.setMdate(new Date().getTime()/1000);
					workDao.update(work);
					result.setDefaultModel("msg", "1");
				}else{
					work.setUsername(user.getUsername());
					work.setContent(content);
					work.setImages("图片"+images);
					work.setCreatedate(t.getTime()/1000);
					work.setMdate(new Date().getTime()/1000);
					workDao.insert(work);
					result.setDefaultModel("msg", "2");
				}
				return result;
			}
		});
	
		return new ModelAndView("", modelMap);
	}
    
    //查看工作历史记录
    @RequestMapping(value = "/work_history")
	public ModelAndView work_history(ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, final HttpServletResponse response)
			throws Exception {
		modelMap = WebExecutor.execute(logger, vo, new Biz() {
			public Result process() {
				Result result = new ResultSupport(true);
				try {
					//近三天时间
					Date today = DateUtil.getToDay();
					Date BeforeDay = DateUtil.getBeforeDay();
					Date BeforetwoDay = DateUtil.getBeforetwoDay();
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					
					TgUser user = UserUtil.getUserFromCookies();
					TgWork  work = new TgWork();
					work.setUsername(user.getUsername());
					
					Integer currPage = 1 ;
					if (vo.getCurrPage()!=null&&!"".equals(vo.getCurrPage())) {
						currPage=vo.getCurrPage();
					}
					
					Integer total = workDao.getWorkByTypeCount(work);
					Page page = PageUtil.createPage(8, currPage, total);
					List<TgWork> list = workDao.getWorkByType(work,page);
					if(list!=null && list.size()>0){
						for(TgWork tgWork:list){
							tgWork.setCreateTime(sdf.format(new Date(tgWork.getCreatedate()*1000)));
						}
					}
					
					result.setDefaultModel("list", list);
					result.setDefaultModel("page", page);
					
					result.setDefaultModel("today", sdf.format(today));
					result.setDefaultModel("BeforeDay", sdf.format(BeforeDay));
					result.setDefaultModel("BeforetwoDay", sdf.format(BeforetwoDay));
				} catch (Exception e) {
					e.printStackTrace();
				}
				return result;
			}
		});
		return new ModelAndView("work/work_history", modelMap);
	}
    
    //工作详情
    @RequestMapping(value = "/work_view")
   	public ModelAndView work_view(ModelMap modelMap, final LoginVo loginVo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, loginVo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				try {
   					String time = request.getParameter("time");
   					String username = request.getParameter("username");
   					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   					DecimalFormat df = new DecimalFormat("######0.0");
					SimpleDateFormat sd = new SimpleDateFormat("HH:mm");
					
   					if(time!=null && !"".equals(time)){
   						String week = DateUtil.convWeek(DateUtil.getDateWeek(sdf.parse(time)));
   						result.setDefaultModel("time", time);
   						result.setDefaultModel("week", week);
   					}
   					
	   				if(username!=null && !"".equals(username)){
	   					List<TgWork> list = workDao.getTgWorkBytime(username ,time);
	   					
	   					if(list!=null && list.size()>0){
	   						Gson gson = new Gson();
							TgWork work = list.get(0);
							work.setCreateTime(time);
							
							if(work.getContent()!=null && !"".equals(work.getContent())){
								JsonValidator json = new JsonValidator();
								Boolean flag = json.validate(work.getContent());
								String ObjContent = "";
								if(flag){
									ObjContent = work.getContent();
								}else{
									byte[] bytes=StringUtil.hexDecode(work.getContent());
									ObjContent = new String(bytes, "UTF-8");
									
								}
								JSONArray array = new JSONArray(ObjContent);
								List<Content> contentList = new ArrayList<Content>();
								for(int i=0;i<array.length();i++){
									Content content = gson.fromJson(array.get(i).toString(), Content.class);
									contentList.add(content);
								}
								if(contentList!=null && contentList.size()>0){
									for(Content content:contentList){
										if(content.getTime()!=null){
											String[] time2 = content.getTime().split("-");
											if(time2!=null){
												Date start = sd.parse(time2[0]);
												Date end = sd.parse(time2[1]);
												Long stime = end.getTime()-start.getTime();
												String count = df.format((double)stime/1000/60/60);
												content.setCount(count);
											}
										}
									}
								}
								result.setDefaultModel("contentList", contentList);
							}
							
							//图片处理
							if(work.getImages()!=null && !"".equals(work.getImages())){
								List<Images> imgList = new ArrayList<Images>();
								boolean flag = StringUtil.getHanzi(work.getImages());
								
								if(flag){
									String[] img = (work.getImages().replace("图片,","")).split(",");
									for(int i=0;i<img.length;i++){
										Images images = new Images();
										images.setUrl(img[i]);
										imgList.add(images);
									}
								}else{
									byte[] bytesImg=StringUtil.hexDecode(work.getImages());
									String images = new String(bytesImg, "UTF-8");
									String[] img = images.split("\\|\\|\\|");
									
									for(int i=0;i<img.length;i++){
										Images image = gson.fromJson(img[i], Images.class);
										imgList.add(image);
									}
									result.setDefaultModel("imgList", imgList);
								}
							}
							
							result.setDefaultModel("work", work);
						}
   					}
   				} catch (Exception e) {
					e.printStackTrace();
				}
   				return result;
   			}
   		});
   		return new ModelAndView("work/work_view", modelMap);
   	}
    
    
    //工作职责列表
    @RequestMapping(value = "/work_duty_list")
   	public ModelAndView work_duty(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgUser user = UserUtil.getUserFromCookies();
   				
   				TgDuty dt = new TgDuty();
   				
   				if(user.getUsername().equals("system")){
   	   				
   	   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();

					Integer total = dutyDao.getDutyCountByType(dt);
					Page page = PageUtil.createPage(8, currPage, total);
   					List<TgDuty> list = dutyDao.getDutyByType(dt, page);
   					result.setDefaultModel("list", list);
   					result.setDefaultModel("page", page);
   				}else{
   					if(user.getMenu()!=null){
   	   					if(user.getMenu().contains("13")){
	   	   					Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
	
	   						Integer total = dutyDao.getDutyCountByType(dt);
	   						Page page = PageUtil.createPage(8, currPage, total);
	   	   					List<TgDuty> list = dutyDao.getDutyByType(dt, page);
	   	   					result.setDefaultModel("list", list);
	   	   					result.setDefaultModel("page", page);
   	   					}else if(user.getUsername().equals("yuanjing")){
   	   						QqGroup qqgr = new QqGroup();
   	   						qqgr.setParent(Long.valueOf(9));
   	   						List<QqGroup> listqq = groupDao.getqqGroup(qqgr);
   	   						List<TgDuty> list = new ArrayList<TgDuty>();
   	   						if(listqq!=null){
   	   							for(QqGroup group :listqq){
   	   								TgUser tgus = new TgUser();
   	   								tgus.setQq_group(group.getId());
   	   							    List<TgUser> listus= userDao.getUserInfoByType2(tgus);
   	   								if(listus!=null && listus.size()>0){
   	   									for(TgUser tg :listus){
   	   										TgDuty duty = new TgDuty();
   	   										duty.setUsername(tg.getUsername());
   	   										
   	   										List<TgDuty> tgduty = dutyDao.getDutyBy(duty);
   	   										if(tgduty!=null && tgduty.size()>0){
   	   											list.add(tgduty.get(0));
   	   										}else{
   	   											duty.setNickname(tg.getNickname());
   	   											duty.setJob(tg.getJob());
   	   											duty.setDepartments(tg.getDepartments());
   	   											duty.setCenter(tg.getRegions());
   	   											list.add(duty);
   	   										}
   	   									
   	   									}
   	   								}
   	   							}
   	   						}
   	   						result.setDefaultModel("list", list);
   	   					}else if(user.getUsername().equals("liulan")){
   	   						List<TgDuty> list = new ArrayList<TgDuty>();
							TgUser tgus = new TgUser();
							tgus.setQq_group(Long.valueOf(8));
						    List<TgUser> listus= userDao.getUserInfoByType2(tgus);
							if(listus!=null && listus.size()>0){
								for(TgUser tg :listus){
									TgDuty duty = new TgDuty();
									duty.setUsername(tg.getUsername());
									
									List<TgDuty> tgduty = dutyDao.getDutyBy(duty);
									if(tgduty!=null && tgduty.size()>0){
										list.add(tgduty.get(0));
									}else{
										duty.setNickname(tg.getNickname());
										duty.setJob(tg.getJob());
										duty.setDepartments(tg.getDepartments());
										duty.setCenter(tg.getRegions());
										list.add(duty);
									}
								}   	   									
   	   						}
   	   						result.setDefaultModel("list", list);
   	   					}else{
	   	   					dt.setUsername(user.getUsername());
	   	   					List<TgDuty> list= dutyDao.findByExample(dt);
	   	   					if(list!=null && list.size()>0){
	   	   						dt = list.get(0);
	   	   						result.setDefaultModel("dt", dt);
	   	   					}
   	   					}
   	   				}else{
	   	   				dt.setUsername(user.getUsername());
	   					List<TgDuty> list= dutyDao.findByExample(dt);
	   					if(list!=null && list.size()>0){
	   						dt = list.get(0);
	   						result.setDefaultModel("dt", dt);
	   					}
   	   				}
   				}
   				
   				return result;
   			}
   		});
   		return new ModelAndView("work/duty_list", modelMap);
   	}
    
    //添加工作职责
    @RequestMapping(value = "/add_duty")
    public ModelAndView addduty (ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, HttpServletResponse response)
					throws BaseException {
		modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
			public Result process() {
				Result result = new ResultSupport(true);
				
				String id = request.getParameter("id");
				String address = request.getParameter("address");
				String duty = request.getParameter("duty");
				
				TgUser user = UserUtil.getUserFromCookies();
				
				TgDuty dt = new TgDuty();
				TgDuty dt2 = new TgDuty();
				if(!user.getUsername().equals("system")){
					dt.setUsername(user.getUsername());
				}
				
				if(address!=null && !"".equals(address)){
					dt.setAddress(address);
				}
				if(duty!=null && !"".equals(duty)){
					dt.setDuty(duty);
				}
				
				if(id!=null && !"".equals(id)){
					dt.setId(Long.valueOf(id));
					dt.setUpdate_time(new Date());
					dutyDao.update(dt);
					result.setDefaultModel("msg", "1");
				}else{
					if(!user.getUsername().equals("system")){
						dt2.setUsername(user.getUsername());
					}
					List<TgDuty> list = dutyDao.findByExample(dt2);
					if(list!=null && list.size()>0){
						result.setDefaultModel("msg", "1");
						return result;
					}
					
					dt.setCreate_time(new Date());
					dutyDao.insert(dt);
					result.setDefaultModel("msg", "1");
				}
				return result;
			}
		});
	
		return new ModelAndView("", modelMap);
	}
    
    
    //工作公告列表
    @RequestMapping(value = "/notice_list")
   	public ModelAndView work_notice_list(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String title = request.getParameter("title");
   				
   				TgNotice note = new TgNotice();
   				
   				if(title!=null && !"".equals(title)){
   					note.setTitle(title);
   				}
   	   				
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();

				Integer total = noticeDao.getNoticeCountByType(note);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgNotice> list = noticeDao.getNoticeByType(note, page);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
   				
   				return result;
   			}
   		});
   		return new ModelAndView("work/notice_list", modelMap);
   	}
    
    
    //进入添加公告页面
    @RequestMapping(value = "/addNotice")
   	public ModelAndView addNotice(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				if(id!=null && !"".equals(id)){
   					TgNotice notice = noticeDao.findById(TgNotice.class, Long.valueOf(id));
   					result.setDefaultModel("notice", notice);
   				}
   				return result;
   			}
   		});
   		return new ModelAndView("work/add_notice", modelMap);
   	}
  
    //添加公告
    @RequestMapping(value = "/addNotice_go")
    public ModelAndView addNotice_go(ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, HttpServletResponse response)
					throws BaseException {
		modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
			public Result process() {
				Result result = new ResultSupport(true);
				
				String id = request.getParameter("id");
				String title = request.getParameter("title");
				String content = request.getParameter("content");
				
				String all_words = request.getParameter("all_words");
				String all_words4 = request.getParameter("all_words4");
				String oname = request.getParameter("oname");
				TgUser user = UserUtil.getUserFromCookies();
				
				TgNotice notice = new TgNotice();
				if(!user.getUsername().equals("system")){
					notice.setUsername(user.getUsername());
				}
				
				if(title!=null && !"".equals(title)){
					notice.setTitle(title);
				}
				if(content!=null && !"".equals(content)){
					notice.setContent(content);
				}
				if(all_words!=null && !"".equals(all_words)){
					notice.setImg_url(all_words);
				}
				if(all_words4!=null && !"".equals(all_words4)){
					notice.setData_url(all_words4);
				}
				if(oname!=null && !"".equals(oname)){
					notice.setData_name(oname);
				}
				notice.setUsername(user.getUsername());
				if(id!=null && !"".equals(id)){
					notice.setId(Long.valueOf(id));
					noticeDao.update(notice);
					result.setDefaultModel("msg", "1");
				}else{
					notice.setCreate_time(new Date());
					noticeDao.insert(notice);
					result.setDefaultModel("msg", "1");
				}
				return result;
			}
		});
	
		return new ModelAndView("", modelMap);
	}
    
    //每日、每周任务完成情况
    @RequestMapping(value = "/task_list")
   	public ModelAndView task_list(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String type = request.getParameter("type");
   				String username = request.getParameter("username");
   				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   				TgUser user = UserUtil.getUserFromCookies();
   				
   				TgTask task = new TgTask();
   				
   				if(type!=null && !"".equals(type)){
   					task.setType(Integer.valueOf(type));
   				}else{
   					return result;
   				}
   				
   				if(username!=null && !"".equals(username)){
   					task.setUsername(username);
   				}else{
   					task.setUsername(user.getUsername());
   				}
   	   				
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();

				Integer total = taskSerice.getTaskCountByType(task);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgTask> list = taskSerice.getTaskByType(task, page);
				
				if(type.equals("1")){
					TgTask task1 = new TgTask();
					if(username!=null && !"".equals(username)){
						task1.setUsername(username);
	   				}else{
	   					task1.setUsername(user.getUsername());
	   				}
					task1.setDate(sdf.format(new Date()));
					task1.setType(Integer.valueOf(type));
					List<TgTask> tlist1 = taskDao.getTaskByType2(task1);
					if(tlist1!=null && tlist1.size()>0){
						task1 = tlist1.get(0);
					}
					TgTask task2 = new TgTask();
					if(username!=null && !"".equals(username)){
						task2.setUsername(username);
	   				}else{
	   					task2.setUsername(user.getUsername());
	   				}
					task2.setDate(sdf.format(DateUtil.getBeforeDay()));
					task2.setType(Integer.valueOf(type));
					List<TgTask> tlist2 = taskDao.getTaskByType2(task2);
					if(tlist2!=null && tlist2.size()>0){
						task2 = tlist2.get(0);
					}
					result.setDefaultModel("task1", task1);
					result.setDefaultModel("task2", task2);
					result.setDefaultModel("date", new Date());
					result.setDefaultModel("beforeDate", DateUtil.getBeforeDay());
				}else if(type.equals("2")){
					List<String> dlist = DateUtil.printWeekdays(sdf.format(new Date()));
					if(dlist!=null && dlist.size()>0){
						String date = dlist.get(0)+"到"+dlist.get(dlist.size()-1);
						result.setDefaultModel("date", date);
						
						TgTask task1 = new TgTask();
						if(username!=null && !"".equals(username)){
							task1.setUsername(username);
		   				}else{
		   					task1.setUsername(user.getUsername());
		   				}
						task1.setStratTime(dlist.get(0));
						task1.setEndTime(dlist.get(dlist.size()-1));
						task1.setType(Integer.valueOf(type));
						List<TgTask> tlist1 = taskDao.getTaskByType2(task1);
						if(tlist1!=null && tlist1.size()>0){
							task1 = tlist1.get(0);
						}
						result.setDefaultModel("task1", task1);
					}
					
					if(list!=null && list.size()>0){
						for(TgTask t:list){
							dlist = DateUtil.printWeekdays(t.getDate());
							t.setDate(dlist.get(0)+"到"+dlist.get(dlist.size()-1));
						}
					}
				}
				result.setDefaultModel("username", username);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
				result.setDefaultModel("type", type);
				
   				return result;
   			}
   		});
   		return new ModelAndView("work/task_list", modelMap);
   	}
    
    //添加每日、每周任务完成情况
    @RequestMapping(value = "/add_task")
   	public ModelAndView add_task(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String type = request.getParameter("type");
   				String matter1 = request.getParameter("matter1");
   				String matter2 = request.getParameter("matter2");
   				String matter3 = request.getParameter("matter3");
   				String date = request.getParameter("date");
   				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   				TgUser user = UserUtil.getUserFromCookies();
				
   				TgTask task = new TgTask();
   				task.setUsername(user.getUsername());
   				if(type!=null && !"".equals(type)){
   					task.setType(Integer.valueOf(type));
   				}else{
   					return result;
   				}
   				task.setMatter1(matter1);
   				task.setMatter2(matter2);
   				task.setMatter3(matter3);
   				if(id!=null && !"".equals(id)){
   					task.setId(Long.valueOf(id));
   					taskDao.update(task);
   					result.setDefaultModel("msg", "1");
   				}else{
   					if(date!=null && !"".equals(date)){
   						task.setDate(date);
   					}else{
   						task.setDate(sdf.format(new Date()));
   					}
   	   				task.setCreate_time(new Date());
   	   				taskDao.insert(task);
   	   			result.setDefaultModel("msg", "1");
   				}
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //管理员日志周报用户列表
    @RequestMapping(value = "/task_teaList")
   	public ModelAndView task_teaList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String nickname = request.getParameter("nickname");
   				TgUser user = UserUtil.getUserFromCookies();
   				
   				TgTask task = new TgTask();
   				if(user.getUsername().equals("guoyuqi")){
   					task.setCenter("北京,宁波,武汉,重庆,湖南");
   				}else if(user.getUsername().equals("huangyanwei")){
   					task.setCenter("天津,广州,东莞,深圳,成都,苏州,无锡");
   				}else if(user.getUsername().equals("lianghong")){
   					task.setCenter("上海,南京,杭州,沈阳");
   				}
   				
   				if(nickname!=null && !"".equals(nickname)){
   					task.setNickname(nickname);
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = taskSerice.getTaskTeaCountByType(task);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgTask> list = taskSerice.getTaskTeacherByType(task, page);
				
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
				
   				return result;
   			}
   		});
   		return new ModelAndView("work/task_teaList", modelMap);
   	}
    
    //黑名单
    @RequestMapping(value = "/blackphone")
   	public ModelAndView blackphone(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String type = request.getParameter("type");
   				String phone = request.getParameter("phone");
   				String phone2 = request.getParameter("phone2");
   				Blkphone blkphone = new Blkphone();
   				if(type!=null&&!"".equals(type)&&!"null".equals(type)){
   					blkphone.setType(Integer.parseInt(type));
   					if(phone2!=null&&!"".equals(phone2)){
   						blkphone.setPhone(phone2);
   					}
   				}else{
   					if(phone!=null&&!"".equals(phone)){
   						blkphone.setPhone(phone);
   					}
   					blkphone.setType(2);
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = blackphoneservice.getblackphoneCount(blkphone);
				Page page = PageUtil.createPage(8, currPage, total);
				List<Blkphone> list = blackphoneservice.getblackphone(blkphone, page);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
				result.setDefaultModel("type", blkphone.getType());
   				return result;
   			}
   		});
   		return new ModelAndView("blackphone/blackphone_list", modelMap);
   	}
   			
	//添加黑名单页面
    @RequestMapping(value = "/add_blackphone")
   	public ModelAndView add_blackphone(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				return result;
   			}
   		});
   		return new ModelAndView("blackphone/add_blackphone", modelMap);
   	}
    
    //添加黑名单
    @RequestMapping(value = "/save_blackphone")
   	public ModelAndView save_blackphone(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String dj_name = request.getParameter("dj_name");
   				String center = request.getParameter("center");
   				String name = request.getParameter("name");
   				String phone = request.getParameter("phone");
   				String reason = request.getParameter("reason");
   				String type = request.getParameter("type");
				
   				Blkphone blkphone = new Blkphone();
   				blkphone.setDj_name(dj_name);
   				blkphone.setCenter(center);
   				blkphone.setName(name);
   				blkphone.setPhone(phone);
   				blkphone.setReason(reason);
   				blkphone.setType(Integer.parseInt(type));
   				
   				List<Blkphone> list = blackphoneservice.findByphone(blkphone);
   				
   				if(list.size()>0){
   					for (Blkphone blkphone2 : list) {
   						if(blkphone2.getPhone().equals(blkphone.getPhone())){
   							int cs = Integer.parseInt(blkphone2.getIs_cs())+1;
   							blkphone2.setUpdate_time(new Date());
   							blkphone2.setIs_cs(String.valueOf(cs));
   							blackphoneservice.uupdate(blkphone2);
   							result.setDefaultModel("msg", "1");
   						}
					}
   				}else{
   					blkphone.setIs_cs("1");
   					blkphone.setCreat_time(new Date());
   					blackphoneservice.iinsert(blkphone);
   					result.setDefaultModel("msg", "1");
   					if(type.equals("1")){
   						result.setDefaultModel("type",type);
   					}else{
   						result.setDefaultModel("type",null);
   					}
   				}
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //出差列表
    @RequestMapping(value = "/travelList")
   	public ModelAndView travelList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String nickname = request.getParameter("nickname");
				
   				TgTravel travel = new TgTravel();
   				
   				if(nickname!=null && !"".equals(nickname)){
   					travel.setNickname(nickname);
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = travelDao.getTravelCountByType(travel);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgTravel> list = travelDao.getTravelByType(travel, page);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
   				return result;
   			}
   		});
   		return new ModelAndView("work/travelList", modelMap);
   	}
    
    //添加出差页面
    @RequestMapping(value = "/addTravel")
   	public ModelAndView addTravel(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				if(id!=null && !"".equals(id)){
   					TgTravel travel = travelDao.findById(TgTravel.class, Long.valueOf(id));
   					result.setDefaultModel("travel", travel);
   				}
   				
				TgUser user = new TgUser();
   				List<TgUser> list = userDao.getUserInfoByType3(user);
				result.setDefaultModel("list", list);
   				return result;
   			}
   		});
   		return new ModelAndView("work/add_travel", modelMap);
   	}
    
    //添加出差
    @RequestMapping(value = "/add_travel")
   	public ModelAndView add_travel(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String c_username = request.getParameter("c_username");
   				String type = request.getParameter("type");
   				String address = request.getParameter("address");
   				String startTime = request.getParameter("startTime");
   				String endTime = request.getParameter("endTime");
   				String times = request.getParameter("times");
   				String msg = request.getParameter("msg");
   				String moneys1 = request.getParameter("moneys1");
   				String moneys2 = request.getParameter("moneys2");
   				String beizhu = request.getParameter("beizhu");
   				
   				TgUser user = UserUtil.getUserFromCookies();
				
   				TgTravel travel = new TgTravel();
   				travel.setUsername(user.getUsername());
   				travel.setC_username(c_username);
   				travel.setType(Integer.valueOf(type));
   				travel.setAddress(address);
   				travel.setStartTime(startTime);
   				travel.setEndTime(endTime);
   				travel.setTimes(Double.valueOf(times));
   				travel.setMsg(msg);
   				if(moneys1!=null && !"".equals(moneys1)){
   					travel.setMoneys1(Double.valueOf(moneys1));
   				}
   				if(moneys2!=null && !"".equals(moneys2)){
   					travel.setMoneys2(Double.valueOf(moneys2));
   				}
   				travel.setBeizhu(beizhu);
   				if(id!=null && !"".equals(id)){
   					travel.setId(Long.valueOf(id));
   					travelDao.update(travel);
   					result.setDefaultModel("msg", "1");
   				}else{
   					travel.setCreate_time(new Date());
   					travelDao.insert(travel);
   					result.setDefaultModel("msg", "1");
   				}
   				
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
	//查询体验课列表
    @RequestMapping(value = "/tiyanke")
   	public ModelAndView tiyanke(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgUser user =UserUtil.getUserFromCookies();
   				String login_name = user.getNickname();
   				Tiyanke tiyanke = new Tiyanke();
   		//		TgTurnover turnover = new TgTurnover();
				String id = request.getParameter("id");
				String center = request.getParameter("center");
				tiyanke.setCenter(center);
				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer totalt = tgTiyankeDao.getCountByCenter(tiyanke);
			    Page page1 = PageUtil.createPage(10, currPage, totalt);
				List<Tiyanke> list1 = tgTiyankeDao.findTiyankeList(tiyanke,page1);
				List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
			    result.setDefaultModel("office_List", office_List);
				result.setDefaultModel("list", list1);
				result.setDefaultModel("page", page1);
   				return result;
   			}
   		});
   		return new ModelAndView("work/tiyanke", modelMap);
   	}
   	
	//员工转正列表
    @RequestMapping(value = "/turnover")
   	public ModelAndView turnover(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgUser user =UserUtil.getUserFromCookies();
   				String login_name = user.getNickname();
   				TgTurnover turnover = new TgTurnover();
				String id = request.getParameter("id");
				String center = request.getParameter("center");
				turnover.setZxzr(login_name);
				turnover.setCenter(center);
			//	turnover.setId(Integer.parseInt(id));
				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = tgTurnoverService.getPreCountByType(turnover);
			    Page page = PageUtil.createPage(10, currPage, total);
				List<TgTurnover> list = tgTurnoverService.findTurnoverList(turnover,page);
				List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
			    result.setDefaultModel("office_List", office_List);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
   				return result;
   			}
   		});
   		return new ModelAndView("work/turnover_list", modelMap);
   	}
	//进入添加员工转正审核页面
    @RequestMapping(value = "/addturnover")
   	public ModelAndView addturnover(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgUser user =UserUtil.getUserFromCookies();
   				
   				TgPeriod period=new TgPeriod();
   				String id = request.getParameter("id");
   			    TgPeriod tg= new TgPeriod();
   			    List<TgPeriod>sylist=new ArrayList<TgPeriod>();
			    if(user.getMenu()!=null&&!user.getMenu().equals("")&&user.getMenu().contains("37")){
			    	System.out.println(user.getMenu());
			     }else{
				   if(user.getType()!=null&&user.getType()==1){//中心主任
				    	tg.setRegion(user.getRegion());
				    	String center=user.getRegions();
				    	sylist=periodDao.getSYUser(tg);
				    	if(center!=null&&!"".equals(center)){
				    		try {
								center=URLEncoder.encode(center, "utf-8");
							} catch (UnsupportedEncodingException e) {
								e.printStackTrace();
							}
						}else{
							center="";
						}
				    	String url = "http://www.yueqiao.org/web/period/period_teacher.json?center="+center;
		                String moneyList = HttpUtil.doGet(url, "", "utf-8", true);

		                net.sf.json.JSONArray listObj = JSONObject.fromObject(moneyList).getJSONArray("list");
		                
		                if (listObj != null && listObj.size() > 0) {
		                	for(int i=0;i<listObj.size();i++){
		                		TgPeriod period1=new TgPeriod();
		                		JSONObject obj = JSONObject.fromObject(listObj.get(i));
		                		period1.setNickname1(obj.getString("name"));
		                		period1.setUsername(obj.getString("login_name"));
		                		sylist.add(period1);
		                	}  
		                 }
				    	
				    }else if(user.getType()!=null && (user.getType()==3 || user.getType()==2)){//部门主管和销售主管
				    	tg.setRegion(user.getRegion());
				    	tg.setDepartments(user.getDepartments());
				    	sylist=periodDao.getSYUser(tg);
				    }else if(user.getUsername().equals("system")){
				    	String url = "http://www.yueqiao.org/web/period/period_teacher1.json";
		                String moneyList = HttpUtil.doGet(url, "", "utf-8", true);

		                net.sf.json.JSONArray listObj = JSONObject.fromObject(moneyList).getJSONArray("list");
		                
		                if (listObj != null && listObj.size() > 0) {
		                	for(int i=0;i<listObj.size();i++){
		                		TgPeriod period1=new TgPeriod();
		                		JSONObject obj = JSONObject.fromObject(listObj.get(i));
		                		period1.setNickname1(obj.getString("name"));
		                		period1.setUsername(obj.getString("login_name"));
		                		sylist.add(period1);
		                	}  
		                 }
				    }
			    }
   				
 	            if(sylist!=null&&sylist.size()>0){
 	            	result.setDefaultModel("sylist", sylist);
 	            }
   				if(id!=null&&!"".equals(id)){
   			    	period.setId(Long.parseLong(id));
   			    }else{
   			    	period.setUsername(user.getUsername());
   			    }
   			    
   			    result.setDefaultModel("nickname", user.getNickname());
   			   return result;
   			}
   		});
   		return new ModelAndView("work/add_turnover", modelMap);
   	}
    //保存员工转正审核
    @RequestMapping(value = "/add_turnover")
   	public ModelAndView add_turnover(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgTurnover turnover = new TgTurnover();
   				TgUser user =UserUtil.getUserFromCookies();
   				String center = user.getRegions();
   				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   				String id = request.getParameter("id");
   				String zxzr = "";
   				if(zxzr!=null&&!"".equals(zxzr)){
   					zxzr = request.getParameter("zxzr");
   				}else{
   					zxzr = user.getNickname();
   				}
				String teacherid = request.getParameter("teacherid");
				String gw=request.getParameter("gw");
				String rztime=request.getParameter("rztime");
				String zpls=request.getParameter("zpls");
				String zryj=request.getParameter("zryj");
				String beizhu1=request.getParameter("beizhu1");
				String zgyj=request.getParameter("zgyj");
				String beizhu2=request.getParameter("beizhu2");
				String status=request.getParameter("mqzd_time");
				/*String nexttime=request.getParameter("xiaci_time");*/
				String zzzztime = request.getParameter("zzzztime");
				
				try {
					turnover.setCenter(center);
					turnover.setZxzr(zxzr);
					turnover.setTeacherid(teacherid);
					turnover.setGw(gw);
					turnover.setRztime(rztime);
					turnover.setZpls(zpls);
					turnover.setZryj(Integer.parseInt(zryj));
					turnover.setBeizhu1(beizhu1);
					if(zgyj!=null&&!"".equals(zgyj)){
						turnover.setZgyj(Integer.parseInt(zgyj));
						turnover.setBeizhu2(beizhu2);
					}
					turnover.setStatus(status);
					
					turnover.setCdate(new Date());
					if(id != null && !"".equals(id)){
						turnover.setId(Integer.valueOf(id));
						if(turnover.getZryj() != turnover.getZgyj()){
							Date monthAdd = DateUtil.MonthAdd(sdf.parse(zzzztime), 1);
							turnover.setNexttime(monthAdd);
							turnover.setZzzztime(monthAdd);
						}else if(turnover.getZryj() == 3 || turnover.getZgyj() == 3){
							turnover.setStatus("建议辞退");
						}
						
						boolean i = tgTurnoverService.update(turnover);
						result.setDefaultModel("msg", i);
					}else{
						Date monthAdd = DateUtil.MonthAdd(sdf.parse(rztime), 6);
						turnover.setNexttime(monthAdd);
						turnover.setZzzztime(monthAdd);
						Long i = tgTurnoverService.AddTgTurnover(turnover);
						result.setDefaultModel("msg",i);
					}
				} catch (ParseException e) {
					e.printStackTrace();
				}
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
  //动态加载是谁把这个员工招聘进来的
    @RequestMapping(value = "/getrecruitByteaid")
   	public ModelAndView getrecruit(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String t_id = request.getParameter("teacherid");
   				TgRecruitment recruitment = new TgRecruitment();
				if(t_id!=null && !"".equals(t_id) && !"null".equals(t_id)){
					recruitment.setName(t_id);
					List<TgRecruitment> list = recruitmentDao.findByName(recruitment);
					if(list.size() == 0){
						result.setDefaultModel("msg", "该员工来的比较早,无法查询她的招聘老师");
					}else{
						result.setDefaultModel("list", list.get(0));
					}
				}else{
					result.setDefaultModel("msg", "该员工来的比较早,无法查询她的招聘老师");
				}
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //修改员工转正记录
    @RequestMapping(value = "/update_turnover")
   	public ModelAndView updateTurnover(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgTurnover turnover = new TgTurnover();
				String id = request.getParameter("id");
				turnover.setId(Integer.parseInt(id));
				List<TgTurnover> list = tgTurnoverService.findByEximple(turnover);
				result.setDefaultModel("list", list);
   				return result;
   			}
   		});
   		return new ModelAndView("work/update_turnover", modelMap);
   	}
    
	//删除员工转正记录
    @RequestMapping(value = "delete_turnover")
   	public ModelAndView deleteTurnover(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgTurnover turnover = new TgTurnover();
				String id = request.getParameter("id");
				turnover.setId(Integer.parseInt(id));
				tgTurnoverService.deleteId(turnover);
				turnover.setId(null);
   				TgUser user =UserUtil.getUserFromCookies();
   				String login_name = user.getNickname();
				String center = request.getParameter("center");
				turnover.setZxzr(login_name);
				turnover.setCenter(center);
				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = tgTurnoverService.getPreCountByType(turnover);
			    Page page = PageUtil.createPage(10, currPage, total);
				List<TgTurnover> list = tgTurnoverService.findTurnoverList(turnover,page);
				List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
			    result.setDefaultModel("office_List", office_List);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
				return result;
   			}
   		});
   		return new ModelAndView("work/turnover_list", modelMap);
   	}
   			
    //员工反馈列表
    @RequestMapping(value = "/periodList")
   	public ModelAndView periodList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				TgUser user =UserUtil.getUserFromCookies();
   				Result result = new ResultSupport(true);
   				String center = "";
   				if(user.getUsername() == "system" || user.getUsername().equals("he")){
   					center = null;
   				}else{
   					center = user.getRegions();
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
   				Map <String,Object>map=tgPeriodService.TgPeriodList(user.getUsername(),user.getMenu(),currPage,center);
   				List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
			    result.setDefaultModel("office_List", office_List);
   			    result.setDefaultModel("list", map.get("list"));
   			    result.setDefaultModel("page", map.get("page"));
   				return result;
   			}
   		});
   		return new ModelAndView("work/period_list", modelMap);
   	}
    //进入添加员工反馈页面
    @RequestMapping(value = "/addPeriod")
   	public ModelAndView addperiod(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgUser user =UserUtil.getUserFromCookies();
   				TgPeriod period=new TgPeriod();
   			 
   				String id = request.getParameter("id");
   			    TgPeriod tg= new TgPeriod();
   			    List<TgPeriod>sylist=new ArrayList<TgPeriod>();
			    if(user.getMenu()!=null&&!user.getMenu().equals("")&&user.getMenu().contains("37")){
			    	System.out.println(user.getMenu());
			     }else{
				   if(user.getType()!=null&&user.getType()==1){//中心主任
				    	tg.setRegion(user.getRegion());
				    	String center=user.getRegions();
				    	sylist=periodDao.getSYUser(tg);
				    	if(center!=null&&!"".equals(center)){
				    		try {
								center=URLEncoder.encode(center, "utf-8");
							} catch (UnsupportedEncodingException e) {
								e.printStackTrace();
							}
						}else{
							center="";
						}
				    	String url = "http://www.yueqiao.org/web/period/period_teacher.json?center="+center;
		                String moneyList = HttpUtil.doGet(url, "", "utf-8", true);

		                net.sf.json.JSONArray listObj = JSONObject.fromObject(moneyList).getJSONArray("list");
		                
		                if (listObj != null && listObj.size() > 0) {
		                	for(int i=0;i<listObj.size();i++){
		                		TgPeriod period1=new TgPeriod();
		                		JSONObject obj = JSONObject.fromObject(listObj.get(i));
		                		period1.setNickname1(obj.getString("name"));
		                		period1.setUsername(obj.getString("login_name"));
		                		sylist.add(period1);
		                	}  
		                 }
				    	
				    }else if(user.getType()!=null && (user.getType()==3 || user.getType()==2)){//部门主管和销售主管
				    	tg.setRegion(user.getRegion());
				    	tg.setDepartments(user.getDepartments());
				    	sylist=periodDao.getSYUser(tg);
				    }else if(user.getUsername().equals("system")){
				    	String url = "http://www.yueqiao.org/web/period/period_teacher1.json";
		                String moneyList = HttpUtil.doGet(url, "", "utf-8", true);

		                net.sf.json.JSONArray listObj = JSONObject.fromObject(moneyList).getJSONArray("list");
		                
		                if (listObj != null && listObj.size() > 0) {
		                	for(int i=0;i<listObj.size();i++){
		                		TgPeriod period1=new TgPeriod();
		                		JSONObject obj = JSONObject.fromObject(listObj.get(i));
		                		period1.setNickname1(obj.getString("name"));
		                		period1.setUsername(obj.getString("login_name"));
		                		sylist.add(period1);
		                	}  
		                 }
				    }
			    }
   				
 	            if(sylist!=null&&sylist.size()>0){
 	            	result.setDefaultModel("sylist", sylist);
 	            }
   				if(id!=null&&!"".equals(id)){
   			    	period.setId(Long.parseLong(id));
   			    }else{
   			    	period.setUsername(user.getUsername());
   			    }
   			    List<TgPeriod>list=periodDao.getByUserId(period);
   			    if(list!=null&&list.size()>0){
   			    	if(id==null||"".equals(id)){
   			    		list.get(0).setId(null);
   			    	}
   			    	if(sylist!=null&&sylist.size()>0){
   			    		list.get(0).setCentre(sylist.get(0).getCentre());
   			    	}
   			    	result.setDefaultModel("period", list.get(0));
   			   }else{
   				    if(sylist!=null&&sylist.size()>0){
			    		 period.setCentre(sylist.get(0).getCentre());
			    		 result.setDefaultModel("period", period);
			        }
   			   }
   			   List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
			   result.setDefaultModel("office_List", office_List);
   			   return result;
   			}
   		});
   		return new ModelAndView("work/add_period", modelMap);
   	}
    /**
     * 添加试用期
     */
    @RequestMapping(value = "/add_period")
   	public ModelAndView add_period(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				TgUser user =UserUtil.getUserFromCookies();
   				TgPeriod period = new TgPeriod();
   				String id = request.getParameter("id");
   				String type = request.getParameter("type");
   				String beizhu = request.getParameter("beizhu");
   				String username = request.getParameter("username");
   				String station=request.getParameter("station");
   				String centre=request.getParameter("centre");
   				String state=request.getParameter("state");
   				if(station!=null&&!station.equals("")){
   					period.setStation(Integer.parseInt(station));
   				}
   				if(type!=null&&!type.equals("")){
   					period.setType(Integer.parseInt(type));
   				}
   				if(state!=null&&!state.equals("")){
   					period.setState(Integer.parseInt(state));
   				}  				
   				period.setCentre(centre);
   				period.setUsername(username);
   				period.setBeizhu(beizhu);
   			    
   				period.setCreate_name(user.getUsername());
   				period.setCreate_time(new Date());
   				List<TgPeriod>sylist=periodDao.getSYUser(period);
   				if(sylist!=null&&sylist.size()>0){
   					period.setName(sylist.get(0).getNickname1());
   				}
   				Map<String,String>map=tgPeriodService.TgPeriodAddPro(user.getMenu(), id, period);
   				result.setDefaultModel("msg", map.get("msg"));
   				return result;
   			}
   		});
   		return new ModelAndView("work/add_period", modelMap);
   	}
    @RequestMapping(value = "/delete_period")
   	public ModelAndView delete_period(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				String id=request.getParameter("id");
   				TgPeriod period = new TgPeriod();
   				if(id!=null&&!"".equals(id)){
   					period.setId(Long.parseLong(id));
   					periodDao.delete(period);
   				}
   				TgUser user =UserUtil.getUserFromCookies();
   				Result result = new ResultSupport(true);
   				String center=request.getParameter("centre");
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
   				Map <String,Object>map=tgPeriodService.TgPeriodList(user.getUsername(),user.getMenu(),currPage,center);
   				List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
			    result.setDefaultModel("office_List", office_List);
   			    result.setDefaultModel("list", map.get("list"));
   			    result.setDefaultModel("page", map.get("page"));
   				return result;
   			}
   		});
   		return new ModelAndView("work/period_list", modelMap);
   	}
    //兼职列表
    @RequestMapping(value = "/prajobList")
   	public ModelAndView prajobList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String nickname = request.getParameter("nickname");
				
   				TgPartjob partjob = new TgPartjob();
   				
   				if(nickname!=null && !"".equals(nickname)){
   					partjob.setNickname(nickname);
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = parjobDao.getPrajobCountByType(partjob);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgPartjob> list = parjobDao.getPrajobByType(partjob, page);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
   				return result;
   			}
   		});
   		return new ModelAndView("work/partjobList", modelMap);
   	}
    
    //添加兼职页面
    @RequestMapping(value = "/addTrajob")
   	public ModelAndView addTrajob(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				if(id!=null && !"".equals(id)){
   					TgPartjob partjob = parjobDao.findById(TgPartjob.class, Long.valueOf(id));
   					result.setDefaultModel("partjob", partjob);
   				}
   				
				TgUser user = new TgUser();
   				List<TgUser> list = userDao.getUserInfoByType2(user);
				result.setDefaultModel("list", list);
   				return result;
   			}
   		});
   		return new ModelAndView("work/add_partjob", modelMap);
   	}
    
    //添加兼职
    @RequestMapping(value = "/add_trajob")
   	public ModelAndView add_trajob(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String username = request.getParameter("username");
   				String type = request.getParameter("type");
   				String date = request.getParameter("date");
   				String time = request.getParameter("time");
   				String address = request.getParameter("address");
   				String fd_count = request.getParameter("fd_count");
   				String xx_count = request.getParameter("xx_count");
   				String gongs = request.getParameter("gongs");
   				String moneys = request.getParameter("moneys");
   				
   				TgUser user = UserUtil.getUserFromCookies();
				
   				TgPartjob partjob = new TgPartjob();
   				partjob.setUsername(username);
   				partjob.setType(Integer.valueOf(type));
   				partjob.setDate(date);
   				partjob.setTime(time);
   				partjob.setAddress(address);
   				if(fd_count!=null && !"".equals(fd_count)){
   					partjob.setFd_count(Integer.valueOf(fd_count));
   				}
   				if(xx_count!=null && !"".equals(xx_count)){
   					partjob.setXx_count(Integer.valueOf(xx_count));
   				}
   				if(moneys!=null && !"".equals(moneys)){
   					partjob.setMoneys(Double.valueOf(moneys));
   				}
   				partjob.setGongs(gongs);
   				if(id!=null && !"".equals(id)){
   					partjob.setId(Long.valueOf(id));
   					parjobDao.update(partjob);
   					result.setDefaultModel("msg", "1");
   				}else{
   					partjob.setAdd_username(user.getUsername());
   					partjob.setCreate_time(new Date());
   					parjobDao.insert(partjob);
   					result.setDefaultModel("msg", "1");
   				}
   				
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //项目需求列表
    @RequestMapping(value = "/demandList")
   	public ModelAndView demandList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String title = request.getParameter("title");
   				String nickname3 = request.getParameter("nickname3");
   				String state = request.getParameter("state");
   				String state2 = request.getParameter("state2");
				
   				TgDemand demand = new TgDemand();
   				
   				if(title!=null && !"".equals(title)){
   					demand.setTitle(title);
   				}
   				if(nickname3!=null && !"".equals(nickname3)){
   					demand.setNickname3(nickname3);
   				}
   				if(state!=null && !"".equals(state)){
   					if(state.equals("4")){
   						demand.setState2(4);
   					}else{
   						demand.setState(Integer.valueOf(state));
   					}
   				}
   				if(state2!=null && !"".equals(state2)){
   					demand.setState2(4);
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = demandDao.getDemandCountByType(demand);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgDemand> list = demandDao.getDemandByType(demand, page);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
				result.setDefaultModel("demand", demand);
   				return result;
   			}
   		});
   		return new ModelAndView("work/demandList", modelMap);
   	}
    
    //添加需求页面
    @RequestMapping(value = "/addDemand")
   	public ModelAndView addDemand(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				if(id!=null && !"".equals(id)){
   					TgDemand demand = demandDao.findById(TgDemand.class, Long.valueOf(id));
   					result.setDefaultModel("demand", demand);
   				}
   				
				TgUser user = new TgUser();
				user.setDepartments("软件工程部");
   				List<TgUser> list = userDao.getUserInfoByType2(user);
				result.setDefaultModel("list", list);
   				return result;
   			}
   		});
   		return new ModelAndView("work/add_demand", modelMap);
   	}
    
    @RequestMapping(value = "/demandDetail")
   	public ModelAndView demandDetail(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
				
   				TgDemand demand = new TgDemand();
   				demand.setId(Long.valueOf(id));
				Page page = PageUtil.createPage(1, 1, 1);
				List<TgDemand> list = demandDao.getDemandByType(demand, page);
				if(list!=null && list.size()>0){
					demand = list.get(0);
				}
				result.setDefaultModel("demand", demand);
   				return result;
   			}
   		});
   		return new ModelAndView("work/demandDetail", modelMap);
   	}
    
    //添加需求   
    @RequestMapping(value = "/add_demand")
   	public ModelAndView add_demand(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String title = request.getParameter("title");
   				String type = request.getParameter("type");
   				String grade = request.getParameter("grade");
   				String fz_username = request.getParameter("fz_username");
   				String kf_username = request.getParameter("kf_username");
   				String hz_username = request.getParameter("hz_username");
   				String content = request.getParameter("content");
   				String startTime = request.getParameter("startTime");
   				String endTime = request.getParameter("endTime");
   				String img_url = request.getParameter("img_url");
   				String data_url = request.getParameter("data_url");
   				String state = request.getParameter("state");
   				String com_date = request.getParameter("com_date");
   				
   				TgUser user = UserUtil.getUserFromCookies();
				
   				TgDemand demand = new TgDemand();
   				demand.setTitle(title);
   				if(type!=null && !"".equals(type)){
   					demand.setType(Integer.valueOf(type));
   				}
   				if(grade!=null && !"".equals(grade)){
   					demand.setGrade(Integer.valueOf(grade));
   				}
   				demand.setFz_username(fz_username);
   				demand.setKf_username(kf_username);
   				demand.setHz_username(hz_username);
   				demand.setContent(content);
   				demand.setStartTime(startTime);
   				demand.setEndTime(endTime);
   				if(state!=null && !"".equals(state)){
   					demand.setState(Integer.valueOf(state));
   				}
   				if(img_url!=null && !"".equals(img_url)){
   					demand.setImg_url(img_url);
   				}
   				if(data_url!=null && !"".equals(data_url)){
   					demand.setData_url(data_url);
   				}
   				demand.setCom_date(com_date);
   				Long ID;
   				if(id!=null && !"".equals(id)){
   					ID = Long.valueOf(id);
   					demand.setId(Long.valueOf(id));
   					demandDao.update(demand);
   					result.setDefaultModel("msg", "1");
   				}else{
   					demand.setUsername(user.getUsername());
   					demand.setCreate_time(new Date());
   					ID = demandDao.insert(demand);
   					result.setDefaultModel("msg", "1");
   				}
   				
   				try {
   					String tea_name="***";
   					if(fz_username!=null && !"".equals(fz_username)){
   						TgUser u = new TgUser();
   	   					u.setUsername(fz_username);
   	   					u = userDao.getUserInfoByType(u);
   	   					if(u!=null){
   	   						tea_name = u.getNickname();
   	   					}
   					}
   					
   					
   					TgUserinfo info = new TgUserinfo();
   					info.setUsername(kf_username);
   					List<TgUserinfo> list = userinfoDao.findByExample(info);
   					title = URLEncoder.encode(title, "utf-8");
   					tea_name = URLEncoder.encode(tea_name, "utf-8");
   					if(state.equals("1")){
						state="待开发";
					}else if(state.equals("2")){
						state="正在开发";
					}else if(state.equals("3")){
						state="已完成";
					}
   					if(!state.equals("已完成")){
   						state = URLEncoder.encode(state, "utf-8");
   						if(list!=null && list.size()>0){
   	   						TgUserinfo userinfo = list.get(0);
   	   						String url = "http://www.yueqiao.org/web/app/senMsg.json?phone="+userinfo.getPhone()+"&id="+ID+"&title="+title+"("+state+")"+"&tea_name="+tea_name;
   	   		                HttpUtil.doGet(url, "", "utf-8", true);
   	   					}
   						
   	   					if(hz_username!=null && !"".equals(hz_username)){
   	   						TgUserinfo info2 = new TgUserinfo();
   	   	   					info2.setUsername(hz_username);
   	   	   					List<TgUserinfo> list2 = userinfoDao.findByExample(info);
   	   	   					if(list2!=null && list2.size()>0){
   	   	   						TgUserinfo userinfo = list2.get(0);
   	   	   						String url = "http://www.yueqiao.org/web/app/senMsg.json?phone="+userinfo.getPhone()+"&id="+ID+"&title="+title+"("+state+")"+"$tea_name="+tea_name;
   	   	   		                HttpUtil.doGet(url, "", "utf-8", true);
   	   	   					}
   	   					}
   					}
	               
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //添加请假记录页面
    @RequestMapping(value = "/addLeave")
   	public ModelAndView addLeave(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				if(id!=null && !"".equals(id)){
   				Leave	leave = leaveDao.findById(Leave.class, Long.valueOf(id));
   					result.setDefaultModel("leave", leave);
   				}
   			    TgOffice office = new TgOffice();
                List<TgOffice> offList = tgOfficeDao.getOfficeName(office);
                TgUserinfo user = new TgUserinfo();
             
                List<TgUserinfo> uList = userinfoDao.getUserInfoByUserInfo(user);
               
					/*
      				user.setJob("网络推广主管");
      				uList.addAll(userinfoDao.getUserInfoByUserInfo(user));

      				user.setJob("市场专员");
      				uList.addAll(userinfoDao.getUserInfoByUserInfo(user));

      				user.setJob("市场主管");
      				uList.addAll(userinfoDao.getUserInfoByUserInfo(user));

      				user.setJob("市场副主管");
      				uList.addAll(userinfoDao.getUserInfoByUserInfo(user));

      				user.setJob("统计专员");
      				uList.addAll(userinfoDao.getUserInfoByUserInfo(user));

      				user.setJob("财务专员");
      				uList.addAll(userinfoDao.getUserInfoByUserInfo(user));
 
      				user.setJob("财务副主管");*/
//                uList.addAll(userinfoDao.getUserInfoByUserInfo(user));

               result.setDefaultModel("uList", uList);
                result.setDefaultModel("offList", offList);

   				return result;
   			}
   		});
   		return new ModelAndView("work/add_leave", modelMap);
   	}
    
    //添加请假记录
    @RequestMapping(value = "/add_leave")
   	public ModelAndView add_leave(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String username = request.getParameter("username");
   				String type = request.getParameter("type");
   				String center_id = request.getParameter("center_id");
   				String reson = request.getParameter("reson");
   				String note = request.getParameter("note");
   				String audit_result = request.getParameter("audit_result");
   				String start_date = request.getParameter("start_date");
   				String end_date = request.getParameter("end_date");
   				String apply_date = request.getParameter("apply_date");
   				String entry_time = request.getParameter("entry_time");
   				
                SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


   				TgUser user = UserUtil.getUserFromCookies();
				
   				Leave leave = new Leave();
   				leave.setUsername(username);
   				if(center_id!=null && !"".equals(center_id)){
   	   				leave.setCenter_id(Long.valueOf(center_id));
   				}
   				
   				if(type!=null && !"".equals(type)){
   	   				leave.setType(Integer.valueOf(type));
   				}
   				
   				leave.setReson(reson);
   				leave.setNote(note);
   				leave.setAudit_result(audit_result);
   				try {
   	   			leave.setStart_date( sdf2.parse(start_date));
   	   			leave.setApply_date(sdf1.parse(apply_date));
   	   			leave.setEnd_date(sdf2.parse(end_date));
   	   			leave.setEntry_time(sdf1.parse(entry_time));

				} catch (Exception e) {
					// TODO: handle exception
					e.printStackTrace();

				}
   				
 
   				if(id!=null && !"".equals(id)){
   					leave.setId(Long.valueOf(id));
   					leaveDao.update(leave);
   					result.setDefaultModel("msg", "1");
   				}else{
   					leave.setCreate_time(new Date());
   					leaveDao.insert(leave);
   					result.setDefaultModel("msg", "1");
   				}
   				
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    
    //请假录入列表
    @RequestMapping(value = "/leaveList")
   	public ModelAndView leaveList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String username = request.getParameter("username");
				
   				Leave leave = new Leave();
   				
   				if(username!=null && !"".equals(username)){
                leave.setUsername(username);
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = leaveDao.getLeaveCountByType(leave);
				Page page = PageUtil.createPage(8, currPage, total);
				List<Leave> list = leaveDao.getLeaveByType(leave, page);
				TgOffice office = new TgOffice();
	            List<TgOffice> offList = tgOfficeDao.getOfficeName(office);

	            result.setDefaultModel("offList", offList);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
   				return result;
   			}
   		});
   		return new ModelAndView("work/leave_list", modelMap);
   	}
 
    //带宽列表
    @RequestMapping(value = "/daikuanList")
   	public ModelAndView daikuanList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String center = request.getParameter("center");
				
   				TgDaikuan daikuan = new TgDaikuan();
   				
   				if(center!=null && !"".equals(center)){
   					daikuan.setCenter(center);
   				}
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = daikuanDao.getDaikuanCountByType(daikuan);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgDaikuan> list = daikuanDao.getDaiKuanByType(daikuan, page);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
				
				List<TgOffice> olist = tgOfficeDao.findAll(TgOffice.class);
				result.setDefaultModel("olist", olist);
   				return result;
   			}
   		});
   		return new ModelAndView("work/daikuanList", modelMap);
   	}
    
    //带宽添加页面
    @RequestMapping(value = "/to_daikuan_add")
   	public ModelAndView to_daikuan_add(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				if(id!=null && !"".equals(id)){
   					TgDaikuan daikuan = daikuanDao.findById(TgDaikuan.class, Long.valueOf(id));
   					result.setDefaultModel("daikuan", daikuan);
   				}
   				
   				List<TgOffice> olist = tgOfficeDao.findAll(TgOffice.class);
				result.setDefaultModel("olist", olist);
   				return result;
   			}
   		});
   		return new ModelAndView("work/add_daikuan", modelMap);
   	}
    
    //添加
    @RequestMapping(value = "/add_daikuan")
   	public ModelAndView add_daikuan(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String center_id = request.getParameter("center_id");
   				String address = request.getParameter("address");
   				String date = request.getParameter("date");
   				String xf_date = request.getParameter("xf_date");
   				String year = request.getParameter("year");
   				String month = request.getParameter("month");
   				String moneys = request.getParameter("moneys");
   				String company = request.getParameter("company");
   				String daikuan = request.getParameter("daikuan");
   				String dk_type = request.getParameter("dk_type");
   				String phone = request.getParameter("phone");
   				String m_msg = request.getParameter("m_msg");
   				String dk_msg = request.getParameter("dk_msg");
   				String img_url = request.getParameter("img_url");

   				TgUser user = UserUtil.getUserFromCookies();
				
   				TgDaikuan dk = new TgDaikuan();
   				dk.setUsername(user.getUsername());
   				if(center_id!=null && !"".equals(center_id)){
   					dk.setCenter_id(Long.valueOf(center_id));
   				}
   				
   				dk.setAddress(address);
   				dk.setDate(date);
   				dk.setXf_date(xf_date);
   				if(year!=null && !"".equals(year)){
   					dk.setYear(Integer.valueOf(year));
   				}
   				if(month!=null && !"".equals(month)){
   					dk.setMonth(Integer.valueOf(month));
   				}
   				if(moneys!=null && !"".equals(moneys)){
   					dk.setMoneys(Integer.valueOf(moneys));
   				}
   				if(daikuan!=null && !"".equals(daikuan)){
   					dk.setDaikuan(Integer.valueOf(daikuan));
   				}
   				if(dk_type!=null && !"".equals(dk_type)){
   					dk.setDk_type(dk_type);
   				}
   				
   				dk.setCompany(company);
   				dk.setPhone(phone);
   				dk.setM_msg(m_msg);
   				dk.setDk_msg(dk_msg);
   				dk.setImg_url(img_url);
 
   				if(id!=null && !"".equals(id)){
   					dk.setId(Long.valueOf(id));
   					daikuanDao.update(dk);
   					result.setDefaultModel("msg", "1");
   				}else{
   					dk.setCreate_time(new Date());
   					daikuanDao.insert(dk);
   					result.setDefaultModel("msg", "1");
   				}
   				
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //宽带信息下载
    @RequestMapping(value = "/add_daikuan_xz")
   	public ModelAndView add_daikuan_xz(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String center = request.getParameter("center");
				
   				TgDaikuan daikuan = new TgDaikuan();
   				
   				if(center!=null && !"".equals(center)){
   					daikuan.setCenter(center);
   				}
				List<TgDaikuan> list = daikuanDao.getDaiKuanByType2(daikuan);
				result.setDefaultModel("list", list);
				
				String name = WriterExcel.writeDaikuanXz(list);
				result.setDefaultModel("name", name);
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    
    
    //巡检列表
    @RequestMapping(value = "/inspectionList")
   	public ModelAndView inspectionList(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String username = request.getParameter("username");
   				String center_id = request.getParameter("center_id");
   				String startTime = request.getParameter("startTime");
   				String endTime = request.getParameter("endTime");
   				String state = request.getParameter("state");
				
   				TgInspection inspection = new TgInspection();
   				inspection.setUsername(username);
   				
   				inspection.setStartTime(startTime);
   				inspection.setEndTime(endTime);
   				if(center_id != null && !"".equals(center_id) ){
   	   				inspection.setCenter_id(Long.valueOf(center_id));

   				}
   				
   					inspection.setState(state);
   				
   				
   				
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
				Integer total = inspectionDao.getInspectionCountByType(inspection);
				Page page = PageUtil.createPage(10, currPage, total);
				List<TgInspection> list = inspectionDao.getInspectionByType(inspection, page);
				 TgOffice office = new TgOffice();
	             List<TgOffice> offList = tgOfficeDao.getOfficeName(office);
	             TgUser userinfo = UserUtil.getUserFromCookies();
	             String user = userinfo.getNickname();
	             result.setDefaultModel("user", user);
	             result.setDefaultModel("username", inspection.getUsername());
	             result.setDefaultModel("state", state);
	            result.setDefaultModel("offList", offList);
	            result.setDefaultModel("inspection", inspection);
	            result.setDefaultModel("startTime", startTime);
	            result.setDefaultModel("endTime", endTime);
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
   				return result;
   			}
   		});
   		return new ModelAndView("work/inspection_list", modelMap);
   	}
    //添加巡检记录
    @RequestMapping(value = "/add_inspection")
   	public ModelAndView add_inspection(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   			
   				String center_id = request.getParameter("center_id");
   				String inspection_time = request.getParameter("inspection_time");
   				String fs = request.getParameter("fs");
   				String fupload = request.getParameter("fupload");
   				String solves = request.getParameter("solves");
   				String supload = request.getParameter("supload");
   				String state = request.getParameter("state");
   				String insp_ids = request.getParameter("insp_ids");
                SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
               TgUser user = UserUtil.getUserFromCookies();
				
   				TgInspection inspection = new TgInspection();
   				//添加所有问题id集合
   		

   				inspection.setUsername(user.getNickname());//巡检人
   				if(center_id!=null && !"".equals(center_id)){
   					inspection.setCenter_id(Long.valueOf(center_id));
   				}
   				
   			
   				
   				try {
   	   			inspection.setInspection_time(sdf1.parse(inspection_time));

				} catch (Exception e) {
					// TODO: handle exception
					e.printStackTrace();

				}
   				//巡检id
   				Long inspID = 0L;
                //记录已存在的巡检问题
   				List <InspProblem> inspPAry = new ArrayList<InspProblem>();
   				InspProblem inspPem = new InspProblem();
   				if(id!=null && !"".equals(id)){
   					inspection.setId(Long.valueOf(id));
   					inspID = Long.valueOf(id);
   					inspection.setM_date(new Date());
   					inspectionDao.update(inspection);
   					inspPem.setInsp_key(inspID);
   					Page page = PageUtil.createPage(50, 1, 100);
   					inspPAry = inspProblemDao.getInspProblemByType(inspPem, page);
   					result.setDefaultModel("msg", "1");
   				}else{
   					
   					inspection.setCreate_time(new Date());
   					inspID = 	inspectionDao.insert(inspection);
   					result.setDefaultModel("msg", "1");
   				}  
                
                
             //问题处理
                String[] fsArray = fs.split(",");
                String[] fuArray = fupload.split(",");
                String[] soArray = solves.split(",");
                String[] suArray = supload.split(",");
                String[] stateArray = state.split(",");
                String[] insp_idsAry = insp_ids.split(",");

                
            
                for (int i = 0; i < fsArray.length; i++) {
                	 InspProblem problem = new InspProblem();
				
					if(i>0){
						problem.setFind_p(fsArray[i]);
						problem.setFind_url(fuArray[i]);
						problem.setSolve_p(soArray[i]);
						problem.setSolve_url(suArray[i]);
						problem.setState(stateArray[i]);
						problem.setInsp_key(inspID);
						String isValid = "1";
						if((fsArray[i].equals("") || fsArray[i].trim().isEmpty()) && (fuArray[i].equals("") || fuArray[i].trim().isEmpty())&& (soArray[i].equals("") || soArray[i].trim().isEmpty())&& (suArray[i].equals("") || suArray[i].trim().isEmpty())){
							isValid = "0";
						}
						
						//检查插入还是更新问题
						if(id != null  && !"".equals(id)){
							
							if(!insp_idsAry[i].equals("undefined")){
								
									problem.setId(Long.valueOf(insp_idsAry[i]) );
									if(isValid.equals("1")){
										inspProblemDao.update(problem);
	
									}
									
								}else{
									if(isValid.equals("1")){
										inspProblemDao.insert(problem);	
									}
									
								
								}	
						}else{
							if(isValid.equals("1")){
								inspProblemDao.insert(problem);
							}
						}
		               
					
					}
					
				}
   				
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    //添加巡检记录页面
    @RequestMapping(value = "/addInspection")
   	public ModelAndView addInspection(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
   		modelMap = WebExecutor.execute(logger, vo, new Biz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String state = request.getParameter("state");
   				String isScan = request.getParameter("isScan");

   			 //记录已存在的巡检问题
					List<InspProblem> inspPAry = new ArrayList<InspProblem>();
					 
	   				InspProblem inspPem = new InspProblem();
	   				
	   					inspPem.setState(state);
	   				
   				if(id!=null && !"".equals(id)){
   				TgInspection	inspection = inspectionDao.findById(TgInspection.class, Long.valueOf(id));
   					result.setDefaultModel("inspection", inspection);
   					
   					inspPem.setInsp_key(Long.valueOf(id));
   					Page page = PageUtil.createPage(50, 1, 100);
                 inspPAry = inspProblemDao.getInspProblemByType(inspPem, page);  
                 
   				}
   			  result.setDefaultModel("inspPAry", inspPAry);
   			  
   			    TgOffice office = new TgOffice();
                List<TgOffice> offList = tgOfficeDao.getOfficeName(office);
                result.setDefaultModel("state", state);
                result.setDefaultModel("isScan", isScan);
                result.setDefaultModel("offList", offList);
	              return result;
   			}
   		});
   		return new ModelAndView("work/add_inspection", modelMap);
   	}
    //人员情况统计表
    @RequestMapping(value = "/personnel_list")
	 public ModelAndView personnel_list(ModelMap modelMap, final BaseVo vo,
	            final HttpServletRequest request, final HttpServletResponse response)
	            throws Exception {
	        modelMap = WebExecutor.execute(logger, vo, new Biz() {
	            public Result process() {
	                Result result = new ResultSupport(true);
	                String center=request.getParameter("center");
	                TgUser user=UserUtil.getCookieUser();
	                TgPersonnelState tgPersonnelState=new TgPersonnelState();
	                if(center!=null&&!"".equals(center)){
	                	tgPersonnelState.setCenter(center);
	                }
	                if(!user.getUsername().equals("system")){
	                	tgPersonnelState.setLogin_name(user.getUsername());
	                }
	                Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
					Integer total = personnelStateDao.getCountPersonnelStateByType(tgPersonnelState);
					Page page=PageUtil.createPage(10, currPage, total);
	                List<TgPersonnelState>list=personnelStateDao.getPersonnelStateByType(tgPersonnelState, page) ;
	            
	                if(list!=null&&list.size()>0){
	                	for(int i=0;i<list.size();i++){
	                		 List<TgPersonnelState>li=personnelStateDao.getPersonnelStateByType1(list.get(i)) ;
	                		 if(li!=null&&li.size()>0){
	                			 for(int j=0;j<li.size();j++){
	                				 li.get(j).setCenter("");
	                			 }
	                			 list.get(i).setPersonnelList(li);
	                		 }
	                	}
	                }
	                List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
    			    result.setDefaultModel("office_List", office_List);
	                result.setDefaultModel("page",page);
	                result.setDefaultModel("list", list);
	                return result;
	            }
	        });
	        return new ModelAndView("work/personnel/personnel_list", modelMap);
	    }
    //查询已提出离职的人员情况
    @RequestMapping(value = "/lizhi_personnel")
	 public ModelAndView lizhi_personnel(ModelMap modelMap, final BaseVo vo,
	            final HttpServletRequest request, final HttpServletResponse response)
	            throws Exception {
	        modelMap = WebExecutor.execute(logger, vo, new Biz() {
	            public Result process() {
	                Result result = new ResultSupport(true);
	                TgUser user=UserUtil.getCookieUser();
	                TgPersonnelState tgPersonnelState=new TgPersonnelState();
	                if(!user.getUsername().equals("system")){
	                	tgPersonnelState.setLogin_name(user.getUsername());
	                }
	                tgPersonnelState.setTeacher_state(5);
	                Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();
					Integer total = personnelStateDao.getCountPersonnelStateByType(tgPersonnelState);
					Page page=PageUtil.createPage(10, currPage, total);
	                List<TgPersonnelState>list=personnelStateDao.getPersonnelStateByType(tgPersonnelState, page);
	            
	                if(list!=null&&list.size()>0){
	                	for(int i=0;i<list.size();i++){
	                		 List<TgPersonnelState>li=personnelStateDao.getPersonnelStateByType2(list.get(i));
	                		 if(li!=null&&li.size()>0){
	                			 for(int j=0;j<li.size();j++){
	                				 li.get(j).setCenter("");
	                			 }
	                			 list.get(i).setPersonnelList(li);
	                		 }
	                	}
	                }
	                List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
    			    result.setDefaultModel("office_List", office_List);
	                result.setDefaultModel("page",page);
	                result.setDefaultModel("list", list);
	                return result;
	            }
	        });
	        return new ModelAndView("work/personnel/personnel_list", modelMap);
	    }
    
    //跳到添加人员情况统计页面
     @RequestMapping(value = "/add_personnel")
	 public ModelAndView add_personnel(ModelMap modelMap, final BaseVo vo,
	            final HttpServletRequest request, final HttpServletResponse response)
	            throws Exception {
	        modelMap = WebExecutor.execute(logger, vo, new Biz() {
	            public Result process() {
	                Result result = new ResultSupport(true);
	                TgPersonnelState tgPersonnelState=new TgPersonnelState();
	                TgUser user=UserUtil.getCookieUser();
	                String id=request.getParameter("id");  
	                if(id!=null&&!"".equals(id)){
	                	tgPersonnelState.setId(Long.parseLong(id));
	                	tgPersonnelState=personnelStateDao.findById(TgPersonnelState.class, Long.parseLong(id));
	                	result.setDefaultModel("tgPersonnelState", tgPersonnelState);
	                }
	                TgUser tgUser=new TgUser();
                    if(!user.getUsername().equals("system")){
                    	tgUser.setRegions(user.getRegions());
                    	List<TgUser>list=userDao.getUserInfoByType2(tgUser);
                    	result.setDefaultModel("userList", list);
                    }else{
                    	List<TgUser>list=userDao.getUserInfoByType2(tgUser);
                    	result.setDefaultModel("userList", list);
                    }
                    List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
    			    result.setDefaultModel("office_List", office_List);
	               
    			    return result;
	            }
	        });
	        return new ModelAndView("work/personnel/add_personnel", modelMap);
	    }
     //保存人员情况统计
     @RequestMapping(value = "/addPersonnel")
    	public ModelAndView addPersonnel(ModelMap modelMap, final BaseVo vo,
    			final HttpServletRequest request, final HttpServletResponse response)
    			throws Exception {
     	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
    			public Result process() {
    				Result result = new ResultSupport(true);
    				String id=request.getParameter("id");
    				String center = request.getParameter("center");
 				    String name=request.getParameter("name");
 				    String teacher_state=request.getParameter("teacher_state");
 				    String station=request.getParameter("station");
 				    String beizhu=request.getParameter("beizhu");
 				    TgPersonnelState tgPersonnelState=new TgPersonnelState();
 				    tgPersonnelState.setCenter(center); 
 				    tgPersonnelState.setName(name);
 				    tgPersonnelState.setBeizhu(beizhu);
 				    if(teacher_state!=null&&!"".equals(teacher_state)){
 				    	tgPersonnelState.setTeacher_state(Integer.parseInt(teacher_state));
 				    }
 				    if(station!=null&&!"".equals(station)){
				    	tgPersonnelState.setStation(Integer.parseInt(station));
				    }
 				    if(id!=null&&!"".equals(id)){
 				    	tgPersonnelState.setId(Long.parseLong(id));
 				    	tgPersonnelState.setCreate_time(DateUtil.getDate());
 				    	personnelStateDao.update(tgPersonnelState);
 				    }else{
 				    	tgPersonnelState.setCreate_time(DateUtil.getDate());
 				    	personnelStateDao.insert(tgPersonnelState);
 				    }
 				    result.setDefaultModel("msg", "1");
    				return result;
    			}
    		});
    		return new ModelAndView("work/personnel/add_personnel", modelMap);
    	}
     //跳到发票申请页面
     @RequestMapping(value = "/apply_invoice")
     public ModelAndView apply_invoice(ModelMap modelMap, final BaseVo vo,
    		 final HttpServletRequest request, final HttpServletResponse response)
    				 throws Exception {
    	 modelMap = WebExecutor.execute(logger, vo, new Biz() {
    		 public Result process() {
    			 Result result = new ResultSupport(true);
    			 String id=request.getParameter("id");
    			 String flg=request.getParameter("flg");
    			 if(null!=id&&!id.equals("")) {
    				 TgInvoice invoice=InvoiceDao.findById(TgInvoice.class,Long.valueOf(id));
    				 result.setDefaultModel("invoice", invoice);
    				 TgOffice office=new TgOffice();
    				 office.setKeyname(invoice.getJd_center_key());
    				 List<TgOffice> tgOffices=tgOfficeDao.findByExample(office);
    				 if(null!=tgOffices&&tgOffices.size()!=0) {
    					 result.setDefaultModel("center", tgOffices.get(0).getName());
    				 }
    			 }
    			
    			 List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
 			     result.setDefaultModel("office_List", office_List);
 			     result.setDefaultModel("flg", flg);
    			 
    			 return result;
    		 }
    	 });
    	 return new ModelAndView("work/personnel/apply_invoice", modelMap);
     }
     //保存发票申请
     @RequestMapping(value = "/save_Apply_Invoice")
 	public ModelAndView save_Apply_Invoice(ModelMap modelMap, final BaseVo vo,
 			final HttpServletRequest request, final HttpServletResponse response)
 			throws Exception {
  	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
 			public Result process() {
 				Result result = new ResultSupport(true);
 				
 				String id=request.getParameter("id");
 				String stu_id = request.getParameter("stu_id");
 				String jd_center_key=request.getParameter("jd_center_key");
			    String student=request.getParameter("student");
			    String moneyDate=request.getParameter("moneyDate");
			    String moneyType1=request.getParameter("moneyType1");
			    String moneyType2=request.getParameter("moneyType2");
			    String method_id=request.getParameter("method_id");
			    String moneys=request.getParameter("moneys");
			    String methodNote=request.getParameter("methodNote");
			    String courseSituation=request.getParameter("courseSituation");
			    String first_trainDate=request.getParameter("first_trainDate");
			    String train_teacher=request.getParameter("train_teacher");
			    String is_otkj=request.getParameter("is_otkj");
			    String is_urgent=request.getParameter("is_urgent");
			    String is_urgentnote=request.getParameter("is_urgentnote");
			    String invoice_content=request.getParameter("invoice_content");
			    String invoice=request.getParameter("invoice");
			    String is_opened=request.getParameter("is_opened");
			    String taxpayerNumber=request.getParameter("taxpayerNumber");
			    String openBank=request.getParameter("openBank");
			    String account=request.getParameter("account");
			    String address=request.getParameter("address");
			    String phone=request.getParameter("phone");
			    String invoice_Amount=request.getParameter("invoice_Amount");
			    String openedAccount=request.getParameter("openedAccount");
			    String traceAccount=request.getParameter("traceAccount");
			    String post_Address=request.getParameter("post_Address");
			    String beizhu=request.getParameter("beizhu");
			    TgUser user=UserUtil.getCookieUser();
				
			    TgInvoice invoiceEntity=new TgInvoice();
			    invoiceEntity.setJd_center_key(jd_center_key);
			    invoiceEntity.setTeacher_name(user.getNickname());
			    invoiceEntity.setStudent(student);
			    invoiceEntity.setMoneyDate(moneyDate);
			    invoiceEntity.setIs_urgent(is_urgent);
			    invoiceEntity.setIs_urgentnote(is_urgentnote);
			    if (stu_id != null && !"".equals(stu_id)) {
			    	invoiceEntity.setStu_id(Long.valueOf(stu_id));
			    }
			    if (moneyType1 != null && !"".equals(moneyType1)) {
			    	invoiceEntity.setMoneyType1(Integer.valueOf(moneyType1));
			    }
			    if (moneyType2 != null && !"".equals(moneyType2)) {
			    	invoiceEntity.setMoneyType2(Integer.valueOf(moneyType2));
			    }
			    if (method_id != null && !"".equals(method_id)) {
			    	invoiceEntity.setMethod_id(Long.valueOf(method_id));
			    }
			    if (moneys != null && !"".equals(moneys)) {
			    	invoiceEntity.setMoneys(Double.valueOf(moneys));
			    }
			    invoiceEntity.setMethodNote(methodNote);
			    invoiceEntity.setCourseSituation(courseSituation);
			    invoiceEntity.setFirst_trainDate(first_trainDate);
			    invoiceEntity.setTrain_teacher(train_teacher);
			    invoiceEntity.setIs_otkj(is_otkj);
			    invoiceEntity.setInvoice_content(invoice_content);
			    invoiceEntity.setInvoice(invoice);
			    invoiceEntity.setIs_opened(is_opened);
			    invoiceEntity.setTaxpayerNumber(taxpayerNumber);
			    invoiceEntity.setOpenBank(openBank);
			    invoiceEntity.setAccount(account);
			    invoiceEntity.setAddress(address);
			    invoiceEntity.setPhone(phone);
			    if(null!=invoice_Amount&&!invoice_Amount.equals("")) {
			    	invoiceEntity.setInvoice_Amount(Double.valueOf(invoice_Amount));
			    }else {
			    	invoiceEntity.setInvoice_Amount(0.0);
			    }
			    if(null!=openedAccount&&!openedAccount.equals("")) {
			    	invoiceEntity.setOpenedAccount(Double.valueOf(openedAccount));
			    }else {
			    	invoiceEntity.setOpenedAccount(0.0);
			    }
			    invoiceEntity.setTraceAccount(traceAccount);
			    invoiceEntity.setPost_Address(post_Address);
			    invoiceEntity.setBeizhu(beizhu);
			    
			    if(null!=id&&!id.equals("")) {
			    	invoiceEntity.setId(Long.valueOf(id));
			    	InvoiceDao.update(invoiceEntity);
			    	result.setDefaultModel("msg", "0");
			    }else {
			    	invoiceEntity.setState("0");
			    	invoiceEntity.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
			    	invoiceEntity.setCreater_name(user.getNickname());
			    	InvoiceDao.insert(invoiceEntity);
			    	result.setDefaultModel("msg", "1");
			    }
 				return result;
 			}
 		});
 		return new ModelAndView("", modelMap);
 	}

     //跳到申请发票明细页面
     @RequestMapping(value = "/invoiceList")
     public ModelAndView invoiceList(ModelMap modelMap, final BaseVo vo,
    		 final HttpServletRequest request, final HttpServletResponse response)
    				 throws Exception {
    	 modelMap = WebExecutor.execute(logger, vo, new Biz() {
    		 public Result process() {
    			 Result result = new ResultSupport(true);
    			 String jd_center_key=request.getParameter("jd_center_key");  
    			 String student=request.getParameter("student");  
    			 String state=request.getParameter("state");  
    			 String teacher_name=request.getParameter("teacher_name");  
    			 String startTime=request.getParameter("startTime");  
    			 String endTime=request.getParameter("endTime");  
    			 
    			 TgUser user=UserUtil.getCookieUser();
                 TgInvoice invoice=new TgInvoice();
                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                 if(jd_center_key!=null&&!"".equals(jd_center_key)&&!"undefined".equals(jd_center_key)){
                	 invoice.setJd_center_key(jd_center_key);
                 }
                 if(student!=null&&!"".equals(student)){
                	 invoice.setStudent(student);
                 }
                 if(state!=null&&!"".equals(state)){
                	 invoice.setState(state);
                 }
                 if(teacher_name!=null&&!"".equals(teacher_name)){
                	 invoice.setTeacher_name(teacher_name);
                 }else {
                	 if(!user.getNickname().equals("薛婷婷")) {
                		 invoice.setTeacher_name(user.getNickname());
                	 }else {
                		 invoice.setTeacher_name("");
                	 }
                 }
                 if (startTime != null && !"".equals(startTime)) {
                     try {
                    	 invoice.setStartTime(sdf.format(sdf.parse(startTime)));
                     } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }
                 if (endTime != null && !"".equals(endTime)) {
                     try {
                    	 invoice.setEndTime(sdf.format(DateUtil.getTommorrowDay1(sdf.parse(sdf.format(sdf.parse(endTime))))));
                     } catch (ParseException e) {
                         e.printStackTrace();
                     }
                 }
                 Integer currPage = 1;
                 if (vo.getCurrPage() != null && !"".equals(vo.getCurrPage())) {
                     currPage = vo.getCurrPage();
                 }
                 Integer total =InvoiceDao.getTgInvoiceCountByType(invoice);
                 Page page = PageUtil.createPage(8, currPage, total);
                 List<TgInvoice> list = InvoiceDao.getInvoiceByType(invoice, page);
                 
    			 List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
    			 result.setDefaultModel("office_List", office_List);
    			 result.setDefaultModel("list", list);
    			 result.setDefaultModel("page", page);
    			 result.setDefaultModel("jd_center_key", jd_center_key);
    			 result.setDefaultModel("teacher_name", teacher_name);
    			 result.setDefaultModel("student", student);
    			 result.setDefaultModel("startTime", startTime);
    			 result.setDefaultModel("endTime", endTime);
    			 result.setDefaultModel("state", state);
    			 
    			 return result;
    		 }
    	 });
    	 return new ModelAndView("work/personnel/invoiceList", modelMap);
     }
     //删除发票申请明细
     @RequestMapping(value = "/deleteInvoice")
     public ModelAndView deleteInvoice(ModelMap modelMap, final BaseVo vo,
                                     final HttpServletRequest request, HttpServletResponse response)
             throws BaseException {
         modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
             public Result process() {
                 Result result = new ResultSupport(true);
                 String id = request.getParameter("id");

                 TgUser user = UserUtil.getUserFromCookies();
                 if (id != null && !"".equals(id)) {
                	 TgInvoice invoice = InvoiceDao.findById(TgInvoice.class, Long.valueOf(id));
                     if (invoice != null) {
                         if (invoice.getTeacher_name().equals(user.getNickname())) {
                             if (invoice.getState().equals("0")) {
                            	 invoice.setId(Long.valueOf(id));
                            	 InvoiceDao.delete(invoice);
                                 result.setDefaultModel("msg", "1");
                             } else {
                                 result.setDefaultModel("msg", "3");
                             }
                         } else {
                             result.setDefaultModel("msg", "2");
                         }
                     }
                 }
                 return result;
             }
         });
         return new ModelAndView("", modelMap);
     }
   //申请发票审核
     @RequestMapping(value = "/updateInvoiceState")
     public ModelAndView updateInvoiceState(ModelMap modelMap, final BaseVo vo,
                                  final HttpServletRequest request, HttpServletResponse response)
             throws BaseException {
         modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
             public Result process() {
                 Result result = new ResultSupport(true);
                 String id = request.getParameter("id");
                 String state = request.getParameter("state");

                 TgUser user = UserUtil.getUserFromCookies();

                 if (id != null && !"".equals(id)) {
                	 TgInvoice invoice = InvoiceDao.findById(TgInvoice.class, Long.valueOf(id));
                	 invoice.setState(state);
                	 invoice.setChecker_name(user.getNickname());
                	 InvoiceDao.update(invoice);
                     result.setDefaultModel("msg", "1");
                 }
                 return result;
             }
         });
         return new ModelAndView("", modelMap);
     }
   //跳到中心业绩查询页面
     @RequestMapping(value = "/queryCenterPerformance")
     public ModelAndView queryCenterPerformance(ModelMap modelMap, final BaseVo vo,
    		 final HttpServletRequest request, final HttpServletResponse response)
    				 throws Exception {
    	 modelMap = WebExecutor.execute(logger, vo, new Biz() {
    		 public Result process() {
    			 Result result = new ResultSupport(true);
    			 String jd_center_key=request.getParameter("jd_center_key");  
    			 String startTime=request.getParameter("startTime");  
    			 if(startTime == null || "".equals(startTime)) {
    				 startTime=new SimpleDateFormat("yyyy-MM").format(new Date());
    			 }
    			 Date start = null;
    			 Date end = null;
    			 List<Date> dlist = DateUtil.getMdatefandl(startTime);
    			 if (dlist != null && dlist.size() > 0) {
    				 start = dlist.get(0);
    				 end = dlist.get(1);
    			 }
    			 List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
    			 List<TgMoney> moneyList=new ArrayList<TgMoney>();
    			 TgMoney moneyEntity=new TgMoney();
    			 if(jd_center_key == null || "".equals(jd_center_key)) {
	    			 if(null!=office_List&&office_List.size()!=0) {
	    				 for(int i=0;i<office_List.size();i++) {
	    					 Double moneysCount=moneysCount(office_List.get(i).getKeyname(),start,end);
	    					 moneyEntity.setCenter(office_List.get(i).getName());
	    					 moneyEntity.setMoneysCount(moneysCount);
	    		 			 moneyEntity.setStartTime(startTime);
	    		 			 moneyList.add(i, moneyEntity);
	    		 			 moneyEntity=new TgMoney();
	    		 			 
	    		 			 if(i>0) {
	    		 				for(int j=0;j<i;j++) {
	    		 					List<TgMoney> moneys=new ArrayList<TgMoney>();
	    		 					if(moneyList.get(j).getMoneysCount()<moneyList.get(i).getMoneysCount()) {
	    		 						moneys.add(0,moneyList.get(j));
	    		 						moneyList.remove(j);
	    		 						moneyList.add(j, moneyList.get(i-1));
	    		 						moneyList.remove(i);
	    		 						moneyList.add(i, moneys.get(0));
	    		 						moneys.clear();
	    		 					}
	    		 				}
	    		 			 }
	    				 }
	    			 }
	    			 result.setDefaultModel("moneyList", moneyList);
    			 }else {
					 Double moneysCount=moneysCount(jd_center_key,start,end);
					 TgOffice office=new TgOffice();
					 office.setKeyname(jd_center_key);
					 List<TgOffice> offices=tgOfficeDao.findByExample(office);
					 if(null!=offices&&offices.size()!=0) {
						 moneyEntity.setCenter(offices.get(0).getName());
					 }
					 moneyEntity.setMoneysCount(moneysCount);
		 			 moneyEntity.setStartTime(startTime);
		 			 moneyList.add(0, moneyEntity);
		 			result.setDefaultModel("moneyList", moneyList);
    			 }
    			 result.setDefaultModel("office_List", office_List);
    			 result.setDefaultModel("jd_center_key", jd_center_key);
    			 result.setDefaultModel("startTime", startTime);
    			 
    			 return result;
    		 }
    	 });
    	 return new ModelAndView("work/personnel/centerPerformanceList", modelMap);
     }
     /**
      * 查询老师的业绩
      * @param keyname
      * @param start
      * @param end
      * @return
      */
     public Double moneysCount(String keyname,Date start,Date end) {
    	 Double moneysCount=0.0;
    	 try {
			TgUserinfo userinfo=new TgUserinfo();
			 userinfo.setRegion(keyname);
			 List<TgUserinfo> infos=userinfoDao.getUserInfoByUserInfo(userinfo);//查询中心下所有老师
			 if(null!=infos&&infos.size()!=0) {
				 for(int j=0;j<infos.size();j++) {
					 TgMoney money = new TgMoney();
					 money.setUsername(infos.get(j).getUsername());
					 money.setStartTime(new SimpleDateFormat("yyyy-MM-dd").format(start));
					 money.setEndTime(new SimpleDateFormat("yyyy-MM-dd").format(end));
					 List<TgMoney> moneys = moneyDao.getMoneysByType2(money);//查询老师的业绩
					 if(null!=moneys&&moneys.size()!=0) {
						 for(int k=0;k<moneys.size();k++) {
							 moneysCount+=moneys.get(k).getMoneys();
						 }
					 }	 
				 }
			 }
		} catch (Exception e) {
			e.printStackTrace();
		}
    	 
    	 return moneysCount;
     }
     /**
      * 中心业绩奖金首页
      * @param modelMap
      * @param vo
      * @param request
      * @param response
      * @return
      * @throws Exception
      */
     @RequestMapping(value = "/center_performance_month_bonus")
     public ModelAndView center_performance_month_bonus(ModelMap modelMap, final BaseVo vo,
    		 final HttpServletRequest request, final HttpServletResponse response)
    				 throws Exception {
    	 modelMap = WebExecutor.execute(logger, vo, new Biz() {
    		 public Result process() {
    			 Result result = new ResultSupport(true);
    			 try {
					String jd_center_key=request.getParameter("jd_center_key");  
					 String startTime=request.getParameter("startTime");
					 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
					 String endTime="";
					 if(startTime == null || "".equals(startTime)) {
						 startTime=new SimpleDateFormat("yyyy-MM").format(new Date());
						 result.setDefaultModel("startTime", startTime);
					 }else {
						result.setDefaultModel("startTime", startTime);
						startTime = sdf.format(DateUtil.getMonthFirst(startTime));
						endTime = sdf.format(DateUtil.getMonthLast(startTime));
					 }
					 Date start = null;
					 Date end = null;
					 List<Date> dlist = DateUtil.getMdatefandl(startTime);
					 if (dlist != null && dlist.size() > 0) {
						 start = dlist.get(0);
						 end = dlist.get(1);
					 }
					 List<TgOffice> office_List = tgOfficeDao.findAll(TgOffice.class);//查询中心
					 List<TgMoney> moneyList=new ArrayList<TgMoney>();
					 TgMoney moneyEntity=new TgMoney();
					 if(jd_center_key == null || "".equals(jd_center_key)) {
						 if(null!=office_List&&office_List.size()!=0) {
							 for(int i=0;i<office_List.size();i++) {
								 Double moneysCount=moneysCount(office_List.get(i).getKeyname(),start,end);
								 moneyEntity.setCenter(office_List.get(i).getName());
								 moneyEntity.setMoneysCount(moneysCount);
					 			 moneyEntity.setStartTime(startTime);
				 				 String center= URLEncoder.encode(office_List.get(i).getName(), "utf-8");
				 				 String url = "http://www.yueqiao.org/web/teaweb/teaTjlist.json?startTime=" +startTime+ "&center="+center;
//				 				 String url = "http://127.0.0.1:8081/web/teaweb/teaTjlist.json?startTime=" +startTime+ "&center="+center;
				 				 String objStr = HttpUtil.doGet(url, "", "utf-8", true);
				 				JSONObject rectea=JSONObject.fromObject(objStr).getJSONObject("rectea");
				 				double xufeiMoney=0.0;
				 				double tuifeiMoney=0.0;
				 				double tuijianMoney=0.0;
				 				if(!rectea.isNullObject()) {
				 					xufeiMoney=Double.valueOf(rectea.getString("xufeiMoney"));
				 					tuifeiMoney=Double.valueOf(rectea.getString("tuifeiMoney"));
				 					tuijianMoney=Double.valueOf(rectea.getString("tuijianMoney"));
				 				}
				 				moneyEntity.setAchievement(moneysCount+xufeiMoney+2*tuijianMoney-2*tuifeiMoney);//中心业绩计算规则(A+B+2C-2D)
				 				moneyEntity.setXufeiMoney(xufeiMoney);
				 				moneyEntity.setTuifeiMoney(tuifeiMoney);
				 				moneyEntity.setTuijianMoney(tuijianMoney);
				 				TgReserve reserve = new TgReserve();
				 				reserve.setRegion(office_List.get(i).getKeyname());
				 				reserve.setStartTime(startTime);
				 				reserve.setEndTime(endTime);
				 				List<TgReserve> list = reserveDao.getReserveByTime(reserve);
				 				if(null!=list&&list.size()>0) {
				 					moneyEntity.setInviteNumber(String.valueOf(list.size()));
				 					String inviteSuccess=new DecimalFormat("0.000000000").format((moneyEntity.getAchievement())/(list.size()*10000));
				 					moneyEntity.setInviteSuccess(inviteSuccess);
				 					if(Double.parseDouble(inviteSuccess)>=0.6) {
				 						moneyEntity.setBonus(new DecimalFormat("0.000").format(moneyEntity.getAchievement()*0.008));
				 					}else if(Double.parseDouble(inviteSuccess)>=0.5&&Double.parseDouble(inviteSuccess)<0.6) {
				 						moneyEntity.setBonus(new DecimalFormat("0.000").format(moneyEntity.getAchievement()*0.006));
				 					}else if(Double.parseDouble(inviteSuccess)>=0.45&&Double.parseDouble(inviteSuccess)<0.5) {
				 						moneyEntity.setBonus(new DecimalFormat("0.000").format(moneyEntity.getAchievement()*0.004));
				 					}else if(Double.parseDouble(inviteSuccess)>=0.36&&Double.parseDouble(inviteSuccess)<0.45) {
				 						moneyEntity.setBonus(new DecimalFormat("0.000").format(moneyEntity.getAchievement()*0.001));
				 					}else if(Double.parseDouble(inviteSuccess)>=0.26&&Double.parseDouble(inviteSuccess)<0.36) {
				 						moneyEntity.setBonus("0.000");
				 					}else if(Double.parseDouble(inviteSuccess)<0.26){
				 						moneyEntity.setBonus("-500.000");
				 					}
				 				}
					 			 moneyList.add(i, moneyEntity);
					 			 moneyEntity=new TgMoney();
							 }
						 }
						 result.setDefaultModel("moneyList", moneyList);
					 }else {
						 Double moneysCount=moneysCount(jd_center_key,start,end);
						 TgOffice office=new TgOffice();
						 office.setKeyname(jd_center_key);
						 List<TgOffice> offices=tgOfficeDao.findByExample(office);
						 if(null!=offices&&offices.size()!=0) {
							 moneyEntity.setCenter(offices.get(0).getName());
						 }
						 moneyEntity.setMoneysCount(moneysCount);
						 moneyEntity.setStartTime(startTime);
						 String center= URLEncoder.encode(moneyEntity.getCenter(), "utf-8");
						 String url = "http://www.yueqiao.org/web/teaweb/teaTjlist.json?startTime=" +startTime+ "&center="+center;
//						String url = "http://127.0.0.1:8081/web/teaweb/teaTjlist.json?startTime=" +startTime+ "&center="+center;
						String objStr = HttpUtil.doGet(url, "", "utf-8", true);
						JSONObject rectea=JSONObject.fromObject(objStr).getJSONObject("rectea");
		 				double xufeiMoney=0.0;
		 				double tuifeiMoney=0.0;
		 				double tuijianMoney=0.0;
		 				if(!rectea.isNullObject()) {
		 					xufeiMoney=Double.valueOf(rectea.getString("xufeiMoney"));
		 					tuifeiMoney=Double.valueOf(rectea.getString("tuifeiMoney"));
		 					tuijianMoney=Double.valueOf(rectea.getString("tuijianMoney"));
		 				}
		 				moneyEntity.setAchievement(moneysCount+xufeiMoney+2*tuijianMoney-2*tuifeiMoney);//中心业绩计算规则(A+B+2C-2D)
		 				moneyEntity.setXufeiMoney(xufeiMoney);
		 				moneyEntity.setTuifeiMoney(tuifeiMoney);
		 				moneyEntity.setTuifeiMoney(tuifeiMoney);
		 			 
		 			 moneyList.add(0, moneyEntity);
		 				result.setDefaultModel("moneyList", moneyList);
					 }
					 result.setDefaultModel("office_List", office_List);
					 result.setDefaultModel("jd_center_key", jd_center_key);
				} catch (Exception e) {
					e.printStackTrace();
				} 
    			 
    			 return result;
    		 }
    	 });
    	 return new ModelAndView("work/personnel/centerPerformanceMonthBonusList", modelMap);
     }
     
}
